Tablesorter pager plugin - ajax with child rows

别说谁变了你拦得住时间么 提交于 2019-12-23 06:01:09

问题


The need is to present data pulled from the server using ajax, in a paginated fashion (see http://mottie.github.io/tablesorter/docs/example-pager-ajax.html). Those data are made of "main rows" and of child rows (for each "main row", there is a child row) (see http://mottie.github.io/tablesorter/docs/example-child-rows.html).

Since the ajax data that must be presented to tablesorter is in JSON format, how should I specify that some rows are child rows?


回答1:


You can store the data within the JSON as HTML markup, e.g.

{
    "rows" : [
        "<tr><td>r0c0</td><td>r0c1</td></tr>",
        "<tr class='tablesorter-childRow'><td>r1c0</td><td>r1c1</td></tr>",
        "<tr><td>r2c0</td><td>r2c1</td></tr>",
        "<tr class='tablesorter-childRow'><td>r3c0</td><td>r3c1</td></tr>"
    ]
}

Then just set up the ajaxProcessing function to work with this data.



来源:https://stackoverflow.com/questions/21972629/tablesorter-pager-plugin-ajax-with-child-rows

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