如何使用yadcf与DataTables deferRender:true

时间:2016-08-23 17:45:04

标签: datatables yadcf

我在DataTable 1.10.11和yadcf 0.8.9并使用ajax数据源。如果启用deferRender,yadcf工作正常,但是列选择过滤器没有填充所有可能的结果。如果我将其设置为false,则所有可能的结果都会显示在列选择过滤器中。有人可以与我分享如何在使用deferRender时获得列选择过滤器的所有可能结果吗?任何帮助是极大的赞赏!顺便说一下,我是编码的新手,所以如果我没有清楚地解释一下,请告诉我。

以下是代码示例:

var table = $('#MyTable').DataTable({
    responsive: true,
    autoWidth: false,
    deferRender: true,
    iDisplayLength: 5,
    aaSorting: [[9,'desc'], [3,'asc'], [4,'asc']],
    ajax:{url:"./assets/json/" + xFileName + ".json"},
    columns: [
        { "data": "col0" },
        { "data": "col1" },
        { "data": "col2" },
        { "data": "col3" },
        { "data": "col4" },
        { "data": "col5" },
        { "data": "col6" },
        { "data": "col7" },
        { "data": "col8" },
        { "data": "col9" },
        { "data": "col10" },
        { "data": "col11" },
        { "data": "col12" },
        { "data": "col13" }
    ],
    columnDefs: [
        {
            "targets": [ 0,1,10,11,12 ],
            "visible": false
        }
    ],

    sDom: "<'row'<'col-lg-6'l><'col-lg-6'f>r>t<'row'<'col-lg-12'i><'col-lg-12 center'Bp>>",
    sPaginationType: "bootstrap",
    oLanguage: {sLengthMenu: "_MENU_ records per page"},
    buttons: ['excelHtml5', ]        

});

yadcf.init(table, [
    {column_number : 2},
    {column_number : 3},
    {column_number : 4},
    {column_number : 6},
    {column_number : 7},
    {column_number : 8},
    {column_number : 13}],
    {cumulative_filtering: true});

0 个答案:

没有答案