,这是很有用的
我需要为一个项目使用https://mottie.github.io/tablesorter/。不幸的是,我是一个完全的英语新手,我认为我的英语能力已经到了极限,所以我想在文档中寻找解决方案:
我正在尝试创建一个下拉过滤器表。但是这个过滤器不应该提取整个单元格的内容,而只提取第一行—这是我的例子:http://kentzler.tv/sorter-example/
在第二列中,下拉菜单应该只显示城市,在第三列中,它应该只提取事件类别而不包含描述。也许有一个简单的方法来分配一个css类什么应该被提取或什么不,但我只是找不到它:(
如果有人能帮忙就太好了!提前感谢和来自德国的问候, 塞巴斯蒂安我相信您想使用的是filter_selectSource
小部件选项。
它将接受:
函数filter_selectSource : function(table, column, onlyAvail) {
// get an array of all table cell contents for a table column
var array = $.tablesorter.filter.getOptions(table, column, onlyAvail);
// manipulate the array as desired, then return it
return array;
}
数组filter_selectSource : {
".model-number" : [ "abc", "def", "ghi", "xyz" ]
}
对象filter_selectSource : {
0 : [
{ value : '/\.js$/', 'data-class' : 'ui-icon-script', text : 'javascript' },
{ value : '/\.(jpg|png|gif)$/', 'data-class' : 'ui-icon-image', text : 'Image' },
// plain strings are also acceptable - the string is added to both the text & value attribute
'foobar',
{ value : '.css', 'data-class' : 'ui-icon-note', text : 'CSS' },
{ value : '.html', 'data-class' : 'ui-icon-document', text : 'HTML page' },
{ value : '/\.(json|txt|md)$/', 'data-class' : 'ui-icon-help', text : 'Misc' },
]
}
如果使用第三方插件来创建选择下拉菜单