fix conditional highlighting to show which sort option is selected

#51
This commit is contained in:
chris.watts90@outlook.com 2020-02-25 15:05:55 +00:00
parent 20bf968675
commit b5aeadfc8f
2 changed files with 8 additions and 8 deletions

View File

@ -88,19 +88,19 @@
<th class="col-md-1"></th> <th class="col-md-1"></th>
<th class="col-md-3"> <th class="col-md-3">
<div class="col-md-1"> <div class="col-md-1">
<a href="#users?sort=firstAsc"><span data-bind="css:{ 'text-success': $root.sortIsActive('firstAsc')}" class="glyphicon glyphicon-chevron-up"></span></a> <a href="#users?sort=firstAsc"><span data-bind="css:{ 'text-warning': $root.sortIsActive('firstAsc')}" class="glyphicon glyphicon-chevron-up"></span></a>
</div> </div>
<div class="col-md-1"> <div class="col-md-1">
<a href="#users?sort=firstDesc"><span data-bind="css:{ 'text-success': $root.sortIsActive('firstDesc')}" class="glyphicon glyphicon-chevron-down"></span></a> <a href="#users?sort=firstDesc"><span data-bind="css:{ 'text-warning': $root.sortIsActive('firstDesc')}" class="glyphicon glyphicon-chevron-down"></span></a>
</div> </div>
<span class="col-md-9">First Name</span> <span class="col-md-9">First Name</span>
</th> </th>
<th class="col-md-3"> <th class="col-md-3">
<div class="col-md-1"> <div class="col-md-1">
<a href="#users?sort=lastAsc"><span data-bind="css:{ 'text-success': $root.sortIsActive('lastAsc')}" class="glyphicon glyphicon-chevron-up"></span></a> <a href="#users?sort=lastAsc"><span data-bind="css:{ 'text-warning': $root.sortIsActive('lastAsc')}" class="glyphicon glyphicon-chevron-up"></span></a>
</div> </div>
<div class="col-md-1"> <div class="col-md-1">
<a href="#users?sort=lastDesc"><span data-bind="css:{ 'text-success': $root.sortIsActive('lastDesc')}"class="glyphicon glyphicon-chevron-down"></span></a> <a href="#users?sort=lastDesc"><span data-bind="css:{ 'text-warning': $root.sortIsActive('lastDesc')}"class="glyphicon glyphicon-chevron-down"></span></a>
</div> </div>
<span class="col-md-9">Last Name</span></th> <span class="col-md-9">Last Name</span></th>
<th class="col-md-1 text-center">Contractor</th> <th class="col-md-1 text-center">Contractor</th>

View File

@ -442,7 +442,7 @@ function DataVM() {
}; };
function convertSortOption(opt) { function convertSortOption(opt) {
if (!opt) { if (!opt) {
return SortOptions.LastAsc; return null
} }
if (opt === "firstAsc") { if (opt === "firstAsc") {
return SortOptions.FirstAsc; return SortOptions.FirstAsc;
@ -461,13 +461,13 @@ function DataVM() {
if (option === "firstAsc" && self.userList().SelectedSortOption === SortOptions.FirstAsc) { if (option === "firstAsc" && self.userList().SelectedSortOption === SortOptions.FirstAsc) {
return true; return true;
} }
if (option === "firstDesc" && self.selectedSort() === SortOptions.FirstDesc) { if (option === "firstDesc" && self.userList().SelectedSortOption === SortOptions.FirstDesc) {
return true; return true;
} }
if (option === "lastAsc" && self.selectedSort() === SortOptions.LastAsc) { if (option === "lastAsc" && self.userList().SelectedSortOption === SortOptions.LastAsc) {
return true; return true;
} }
if (option === "lastDesc" && self.selectedSort() === SortOptions.LastDesc) { if (option === "lastDesc" && self.userList().SelectedSortOption === SortOptions.LastDesc) {
return true; return true;
} }
return false; return false;