and i guess you won’t have anymore limitation even for your first query
now, i don’t really understand why you use ajax to load the whole data as in this case it would be more suitable to use datatables native progressive enhancement, that to say, load the whole stuff with ci and then apply datatables to the loaded table
but well, nevermind, this should work
have swing
Thanks virtualgadjo, this is actually for a work project, and I’m currently at home (it’s 11:30PM here at the moment)... But I’ll try that in the morning when I get back to work and see what happens.
I’m pretty new to PHP, so I still tend to get confused by things that seem simple and logical to your everyday PHP devs… I’m sure I’ll get there one day though.
...surely it would make sense to have a method that could be accessed like this:
$this->datatables->limit();
Which doesn’t exist currently.. Or am I missing something? If I’m not missing anything, I think I should probably just write a quick method to provide this functionality.
Edit: Ok, I might have jumped the gun slightly there.. I’m not quite familiar enough with CodeIgniter to go editing/extending functionality like that. However, I did just figure out if I comment out the call to the get_paging() method, then my SQL query runs without any limit (which actually suits this particular project perfectly anyway).
My generate() method now looks like this:
public function generate($charset = 'UTF-8') { // $this->get_paging(); $this->get_ordering(); $this->get_filtering(); return $this->produce_output($charset); }
as its original version didn’t allow the -1 trick to work with the paging function
but i think if you want to get all your data it’s here things must happen
one more thing you may have to check is tou iDisplayLength, by default it’s -1 in datatables, may be you could also try
now, once more, it’s a funny idea to get all the data with ajax instead of retreiving them with a simple query in a model and then use datatables on the returned table…
I don’t think that would work for me, my AJAX request is sent as a GET, not a POST. I haven’t specified the type though, I’m simply fetching the data with the following:
now, once more, it’s a funny idea to get all the data with ajax instead of retreiving them with a simple query in a model and then use datatables on the returned table…
have swing
Having a table search feature is essential with the number of rows I’m working with here, only searching through 100 records at a time seems pretty counter intuitive to me. :/
first, as long as you have
“iDisplayLength”: 10,
in your js, the table will only display… 10 éléments
what i mean about the ajax thing is that, the serverside processing using datatables library is interesting only if you don’t want to display all the data as it makes lighter requests
when you want to get all the data at first you don’t need ajax nor datatables serverside library, just get all your data with a request in a ci model, put it in the view and then, as you want to take advantage of datatables functionnalities you can just use it without the server sideprocess, in its native progressive enhancement way in fact
first, as long as you have
“iDisplayLength”: 10,
in your js, the table will only display… 10 éléments
True, but all rows are included in the table, only 10 are shown per page. The search still searches the entire table, regardless of whether a row is on the currently displayed page or not.
virtualgadjo - 02 August 2012 08:11 AM
what i mean about the ajax thing is that, the serverside processing using datatables library is interesting only if you don’t want to display all the data as it makes lighter requests
when you want to get all the data at first you don’t need ajax nor datatables serverside library, just get all your data with a request in a ci model, put it in the view and then, as you want to take advantage of datatables functionnalities you can just use it without the server sideprocess, in its native progressive enhancement way in fact
have swing
I’ve got a function set up to watch for AJAX calls, and display a global “Working..” message while waiting for a response. That was the main reason for using AJAX for the initial data load, however this same table will have it’s contents replaced dynamically through AJAX calls without reloading the entire page.
So, thanks for the suggestions, but to be honest the way it’s set up at the moment makes a bit more sense to me.
reading what you’re saying i think i didn’t understand your first post…
is the problem being the search request not sending the whole stuff and not when you first instaciate the table ?
something else, i think you should not change generate function but get_paging
and if my second understanding is the correct one my very first modification of get_paging should be enough for it to work
actually, as i said, if no ilength is posted, datatables is set to use -1 by default, that to say, return everything
I’m having problem with IgnitedDatatables-native-php-version.
I’m using MySQLi and getting this error:
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2) in xxx/scripts/datatables/dataTables.ignition.php on line 64