how to use yadcf with DataTables deferRender: true

回眸只為那壹抹淺笑 提交于 2019-12-12 03:16:49

问题


I am on DataTable 1.10.11 and yadcf 0.8.9 and using ajax data source. yadcf is working great however the column select filters are not populating with all possible results if I enable deferRender. If I set this to false all possible results appear in the column select filter. Could someone share with me how to get all possible results for the column select filters while using deferRender? Any help is greatly appreciated! BTW I am new to coding so if I did not explain something clearly please let me know.

Here is a sample of the code:

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});

来源:https://stackoverflow.com/questions/39107672/how-to-use-yadcf-with-datatables-deferrender-true

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!