cakePHP and Pagination
cakePHP and Pagination
martin@sommer.net
Posts: 15Questions: 0Answers: 0
Has anyone used DataTables with cakePHP, successfully implemented Pagination through Ajax, and can provide example code?
I am successfully populating the table from cakePHP, but am not getting the footer line "Showing X to Y of Z entries", am not getting paging, and am not sure how to pass the values iTotalRecords iTotalDispalyRecords.
Any examples?
Thanks,
Martin
I am successfully populating the table from cakePHP, but am not getting the footer line "Showing X to Y of Z entries", am not getting paging, and am not sure how to pass the values iTotalRecords iTotalDispalyRecords.
Any examples?
Thanks,
Martin
This discussion has been closed.
Replies
hth, pktm
A working cakePHP example, would be great.
Martin
http://datatables.net/forums/comments.php?DiscussionID=1718
Any ideas?
Thanks,
Martin
1) For the sAjaxSource parameter, use a combination of JavaScript and cakePHP:
'sAjaxSource': src="<?= $this->base;?>/controller/action/<?=$dataId;?>"
2) Dynamically turn off debug on the ajax function, so DataTables can read the returned json data:
Configure::write('debug', 0);
3) Use the "DataTables server-side processing example" as a base, and modify it for cake PHP:
Ref: http://datatables.net/examples/data_sources/server_side.html
Martin
could you give an example of a "modified code" adapted from "DataTables server-side processing example" .
It's been 2 days that I'm killing myself trying to find a way to make Cake and datatable work together.
Thanks, guignol
Also i find http://www.php-example.com/2010/08/20-steps-to-make-cakephp-blog-project.html useful to make CakePHP blog porject step by step code example.
Kelly Blue
University of Technology, Sydney, Australia