向DataTables添加更多选项

时间:2014-07-25 10:23:04

标签: datatables

我有这个:

<script type="text/javascript">
    $(document).ready(function(){
        $('#example').dataTable({
            "iDisplayLength": 50,
            "sPaginationType": "full_numbers",
            "aaSorting": [[6, 'asc']]
        })
        .columnFilter({
            aoColumns: [ 
                {
                    type: "select",
                    values: [
                        'La Noscea',
                        'Black Shroud',
                        'Thanalan',
                        'Coerthas',
                        'Mor Dhona'
                    ]  
                },
                {
                    type: "select",
                    values: [
                        'Western La Noscea',
                        'Middle La Noscea',
                        'Eastern La Noscea',
                        'Lower La Noscea',
                        'Upper La Noscea',
                        'Outer La Noscea',
                        'Eastern Shroud',
                        'South Shroud',
                        'Central Shroud',
                        'North Shroud',
                        'Western Thanalan',
                        'Eastern Thanalan',
                        'Southern Thanalan',
                        'Northern Thanalan',
                        'Central Thanalan',
                        'Coerthas Central Highlands',
                        'Mor Dhona'
                    ]  
                },
                { type: "text" },
                { type: "select", values: [ 'S', 'A', 'B']  }
            ],
        });
    });
</script>

我想补充一下:

$(document).ready(function() {
    $('#example').dataTable({
        "dom": '<"toolbar">frtip'
    });

    $("div.toolbar").html('<b>Custom tool bar! Text/images etc.</b>');
} );

我尝试了100种不同的方式,有人可以帮助我,也许还可以告诉我如果我想添加更多东西我应该寻找什么?

非常感谢你。

1 个答案:

答案 0 :(得分:0)

我得到了它的工作:

<script type="text/javascript">
    $(document).ready(function () {
        $('#example').dataTable({
            "iDisplayLength": 50,
            "sPaginationType": "full_numbers",
            "aaSorting": [[6, 'asc']],
            "dom": '<"toolbar">frtip'
        })
        .columnFilter({
            aoColumns: [ 
                {
                    type: "select",
                    values: [
                        'La Noscea',
                        'Black Shroud',
                        'Thanalan',
                        'Coerthas',
                        'Mor Dhona'
                    ]  
                },
                {
                    type: "select",
                    values: [
                        'Western La Noscea',
                        'Middle La Noscea',
                        'Eastern La Noscea',
                        'Lower La Noscea',
                        'Upper La Noscea',
                        'Outer La Noscea',
                        'Eastern Shroud',
                        'South Shroud',
                        'Central Shroud',
                        'North Shroud',
                        'Western Thanalan',
                        'Eastern Thanalan',
                        'Southern Thanalan',
                        'Northern Thanalan',
                        'Central Thanalan',
                        'Coerthas Central Highlands',
                        'Mor Dhona'
                    ]  
                },
                { type: "text" },
                { type: "select", values: [ 'S', 'A', 'B']  }
            ],
        });

        $("div.toolbar").html('<b>Custom tool bar! Text/images etc.</b>');
    });
</script>