0

我正在研究 w2ui,在那里我获得了自己的自定义排序功能。排序功能正在查找,但箭头未显示在表格标题中。

我已经在姓氏中应用了我的自定义排序,您可以在单击名字时看到箭头。

如何显示箭头标记?

提前致谢。

JSFIDDLE 链接

onSort : function(event){
            if(event.field == "lname"){
                event.preventDefault();
                records = w2ui.grid.records;
             /*My custom logic starts here.(example only) */
                if(ascending){
                records.sort();
                }
                else{
                    records.reverse();
                }
                ascending = !ascending;
                w2ui.grid.reset();
           /*My custom logic endshere.(example only) */
            }
        }
4

1 回答 1

0

我添加了这段代码,我得到了箭头。

var addThisClass;
            if(ascending)
                addThisClass="w2ui-sort-up"
            else
                addThisClass="w2ui-sort-down"
            $(".w2ui-grid .w2ui-grid-body table .w2ui-head").each(function(){
                console.log($(this).text())
                if($(this).text().indexOf("Last Name")!=-1){
                    $(this).addClass(addThisClass);
                    $(this).find("div").addClass(addThisClass);
                }
            })

我已经更新了jsFiddle

于 2015-10-24T11:16:09.203 回答