表分拣机基于AJAX的列过滤器

时间:2014-11-18 05:37:04

标签: ajax tablesorter

我可以在表格分类器上进行基于ajax的过滤搜索吗?我也喜欢这样更新我的表,或者无论如何将onchange事件与所有过滤列绑定在一起?

以下是我的代码:

.tablesorter({
    theme: 'blue',
    widthFixed: true,
    widgets: [ 'stickyHeaders', 'columnSelector','filter'],
    textExtraction: function(node, table, cellIndex){
        return $(node).text().replace(/\s'/g,'');
    },
    headers: {0: { filter: false},6: { filter: false},7: { filter: false},8: { filter: false}},
    initialized: function(){
        lastSearch = $table.data('lastSearch');
    },
    widgetOptions : {


      // Use the $.tablesorter.storage utility to save the most recent filters
      filter_saveFilters : false,
      // 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 : {
        /*0 : function($cell, indx){
          return $.tablesorter.filterFormatter.uiDatepicker( $cell, indx, {     
            dateFormat: 'dd/mm/yyyy',
            changeMonth: true,
            changeYear : true
          });
        },*/
        // Alphanumeric (match)
        4 : function($cell, indx){
          return $.tablesorter.filterFormatter.select2( $cell, indx, {
            match : true,         // adds "filter-match" to header
           // cellText : 'Select: ', // Cell text
            width: '90%',         // adjusted width to allow for cell text
            value: [<%=createdBy%>], // initial values
            placeholder: "Search.."

          });
        },
        5 : function($cell, indx){
          return $.tablesorter.filterFormatter.select2( $cell, indx, {
            match : true,         // adds "filter-match" to header
           // cellText : 'Select: ', // Cell text
            width: '90%',         // adjusted width to allow for cell text
            value: [<%=actions%>], // initial values
            placeholder: "Search.."
          });
        },
      /*7 : function($cell, indx){
          return $.tablesorter.filterFormatter.uiDatepicker( $cell, indx, {
            // from : '08/01/2013', // default from date
            // to   : '1/18/2014',  // default to date
            dateFormat : 'dd/MM/yyyy',
            changeMonth : true,
            changeYear : true,
            cellText : ""
          });
        }*/
      },



      // option added in v2.16.0
      filter_selectSource : {
        // Alphanumeric match (prefix only)
        // added as select2 options (you could also use select2 data option)
        4 : function(table, column) {
          return [<%=createdBy%>];
        },
        5 : function(table, column) {
          return [<%=actions%>];
        },
      }

    /*  filter_placeholder : {
        from : 'From...',
        to   : 'To...'
      }*/

    },

  });

0 个答案:

没有答案