Fix dynamic headers function
This commit is contained in:
parent
bff7ea6a19
commit
c0f5b922a6
|
@ -107,18 +107,32 @@
|
||||||
|
|
||||||
list.sort("title", {order: "asc"});
|
list.sort("title", {order: "asc"});
|
||||||
|
|
||||||
list.on("updated", function(){
|
list.on("updated", function(list){
|
||||||
$("#compatibility-list tbody tr.key").removeClass("key");
|
var $list = $(list.list);
|
||||||
if ($("#compatibility-list thead").find("th.asc[data-sort='title'], th.desc[data-sort='title']").length){
|
var $items = $list.children();
|
||||||
$("#compatibility-list tbody tr[data-key]").each(function(){
|
$items.removeClass("key");
|
||||||
|
if ('title' == getLastSorted(list)){
|
||||||
|
$items.each(function(){
|
||||||
var key = $(this).attr("data-key")
|
var key = $(this).attr("data-key")
|
||||||
if ($("tr[data-key='" + key + "']:first").is($(this))){
|
if (
|
||||||
|
$list
|
||||||
|
.children("[data-key='" + key + "']")
|
||||||
|
.first()
|
||||||
|
.is( $(this) )
|
||||||
|
){
|
||||||
$(this).addClass("key");
|
$(this).addClass("key");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function getLastSorted(list){
|
||||||
|
var currentSorted = $(list.listContainer).find(".asc, .desc").attr("data-sort");
|
||||||
|
if ('undefined' !== typeof currentSorted)
|
||||||
|
list.lastSorted = currentSorted;
|
||||||
|
return list.lastSorted;
|
||||||
|
}
|
||||||
|
|
||||||
function filterTable(_) {
|
function filterTable(_) {
|
||||||
var rating = this.name;
|
var rating = this.name;
|
||||||
var index = this.index;
|
var index = this.index;
|
||||||
|
|
Reference in New Issue