0

i'm looking suggestion based answer as I'm doing work with data tales in cakephp to display my data. corrently i'm using datatables to display data. but the issue is all data load on first load of page, i'm supposing if data is too much in database like 100,000 records then it will create issue because it will take long time to load in view(I suppose it is not a good approach). I wanna load 100 record first time then on click next more data should be.

Problem 2 I looked cakephp plugin it is nice but only to load data for same model and controller. If I load model "A" in controller "B" , then it does not work to display model "A" data, it keep search for model "B".

I know one is pagination option to load limited data, but i'm looking for data tables, if it exist.

coder
  • 156
  • 3
  • 23

1 Answers1

0

I know one is pagination option to load limited data, but i'm looking for data tables, if it exist.

Are you sure your know what you're doing? Datatables is just a script that uses client side pagination through a script that gets data from a datasource. That script can get it's data through many sources, one is AJAX. What you want is in fact pagination:

Basic concept: The Datatables script makes an AJAX call, the server side returns the paginated data as JSON and the Datatables script will process it. Read the manuals.

floriank
  • 25,546
  • 9
  • 42
  • 66
  • Thanks for reply @burzum i choose pagination for this and your response guide me to take right decision. now one issue is, associated model are not load, only main model's data load while working with pagination. – coder Dec 31 '14 at 16:05
  • this code i'm using to paginate and working fine. except to load associated models. $this->loadModel('User'); $this->paginate = array( 'conditions' => array('User.id !=' => '6'), 'limit' => 3, 'order' => array('id' => 'desc') ); // we are using the 'User' model $users = $this->paginate('User'); – coder Dec 31 '14 at 16:10
  • And what exactly is not working with that? It should paginate the users table. – floriank Dec 31 '14 at 16:11
  • yes it is doing, i was asking to retrieve User table's associated models data while doing pagination, but now i have done that. thanks – coder Dec 31 '14 at 18:25