I want to use Div structure in Datatables instead

2019-09-20 10:42发布

I want to use Datatables with div structure instead of tables. the purpose is to meet design requirements. is there any possible way or any alternative for that?

2条回答
唯我独甜
2楼-- · 2019-09-20 11:26

Sure you can! I think what you're looking for is manipulating the dom object of Datatables!


A simple example of adding some divs to the table ->

$('#example').dataTable({
    dom: '<"top"i>rt<"bottom"flp><"clear">'
});

This will give you wrapper divs around table content, filters and the whole table. You can learn more by reading the official documentation from their website.
Here's a link to the documentation ->https://datatables.net/reference/option/dom

查看更多
3楼-- · 2019-09-20 11:30

No you will not be able to do this... The core of Datatables will only work on table elements and child thead tbody tfooter tr td th elements... You will need to write your own pagination code to handle your div cards or download another plugin... jquery Datatables will not support that.

here is a good one? This even looks like jquery datatables pagination. https://esimakin.github.io/twbs-pagination/#demo

查看更多
登录 后发表回答