我想实现datepicker的一个input.The问题是,输入是在表排序插件中创建的,而我不知道如何做到这一点。
在这里你可以找到http://mottie.github.com/tablesorter/docs/example-widget-filter-custom.html的代码:https://github.com/Mottie/tablesorter/blob/master/js/jquery.tablesorter.widgets.js
发布于 2013-02-18 07:00:15
在版本2.7.7中,表排序筛选器小部件中添加了一个名为filter_formatter的新选项。现在,您可以添加jQuery UI日期选择器范围,以使用此选项筛选表内容。
您需要包含一个名为"jquery.tablesorter.widgets-filter-formatter.js“的新文件,并添加如下所示的代码来添加它。这是它工作的demo。
$(function() {
// call the tablesorter plugin
$("table").tablesorter({
theme: 'blue',
// hidden filter input/selects will resize the columns, so try to minimize the change
widthFixed : true,
// initialize zebra striping and filter widgets
widgets: ["zebra", "filter"],
widgetOptions : {
// jQuery selector string of an element used to reset the filters
filter_reset : 'button.reset',
// add custom selector elements to the filter row
filter_formatter : {
6 : function($cell, indx){
return $.tablesorter.filterFormatter.uiDatepicker( $cell, indx, {
from : '12/1/2012', // default from date
to : '2/1/2014', // default to date
changeMonth: true,
changeYear : true
});
}
}
}
});
});https://stackoverflow.com/questions/12198998
复制相似问题