使用jQuery数据表的分页 [英] pagination using jquery datatable
问题描述
我正在使用jquery数据表进行分页. 我的数据不是extaly表,从db到数据库的第一行说id,名称,位置……我在jsp中显示3行,例如第一行id,第二行名称然后是第三行位置...我有1500条奇怪的行在分贝. 为此,我需要进行分页. 而且,当用户单击下一个链接时,它也应转到服务器以获取下一个记录.
我知道如何从服务器端获取有限数量的结果....
我需要有关jsp配置的帮助.....我是jquery的新手...如何配置数据表.
有什么想法怎么做?
您可以看到,"bServerSide": true
和源"sAjaxSource": "yourFile.php"
.
然后在您的php上,您必须返回与波纹管相同的对象:
{
"sEcho": 1,
"iTotalRecords": "57", // total number of rows
"iTotalDisplayRecords": "57", // number of rows after the filter
"aaData": [//your data]
}
您可以在服务器端处理参考上看到必须使用哪些参数. /p>
I am doing pagination using jquery datatable. My data is not exctaly table, 1 row from db say id, name, location...... i display in jsp in 3 rows like first row id,second row name then third row location...i have 1500 hunderd rows in db. For this i need to do pagination. And also when the user clicks on next link it should go to server for next records.
I know how to get the restricted number of results from server side ....
I need help for jsp configuration.....i am new to jquery...how to configure datatable.
Any ideas how to do it?
As you can see here you can set "bProcessing": true
, "bServerSide": true
and the source "sAjaxSource": "yourFile.php"
when you init your table.
Then on your php you have to return the same object as bellow:
{
"sEcho": 1,
"iTotalRecords": "57", // total number of rows
"iTotalDisplayRecords": "57", // number of rows after the filter
"aaData": [//your data]
}
You can see what parameters you have to use on the server-side processing reference.
这篇关于使用jQuery数据表的分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!