EllisLab text mark
Advanced Search
25 of 30
25
   
Ignited DataTables
Posted: 02 August 2012 07:59 AM   [ # 361 ]   [ Rating: 0 ]
Avatar
Joined: 2012-07-19
32 posts
virtualgadjo - 02 August 2012 07:42 AM

one more thing you may have to check is tou iDisplayLength, by default it’s -1 in datatables, may be you could also try

$iLength = isset($this->ci->input->post('iDisplayLength')) ? $this->ci->input->post('iDisplayLength') : -1
always in the get_paging function

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:

$(document).ready(function() {
 
// Initialse DataTables
 
var oTable = $('#dataTable').dataTable({
  
"oLanguage"{
   
"sSearch""Search all columns:",
   
"sLoadingRecords"""
  
},
  
"aLengthMenu"[[10,25,50],[10,25,50]],
  
"iDisplayLength"10,
  
"sPaginationType""full_numbers",
  
"sAjaxSource"'main/get_store_list_json',
  
"bDeferRender"true,
 
});
}); 

I don’t quite follow what you mean here though..

virtualgadjo - 02 August 2012 07:42 AM

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. :/

 
Posted: 02 August 2012 08:11 AM   [ # 362 ]   [ Rating: 0 ]
Joined: 2011-03-24
22 posts

first, as long as you have
“iDisplayLength”: 10,
in your js, the table will only display… 10 éléments smile

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

 
Posted: 02 August 2012 08:25 AM   [ # 363 ]   [ Rating: 0 ]
Avatar
Joined: 2012-07-19
32 posts
virtualgadjo - 02 August 2012 08:11 AM

first, as long as you have
“iDisplayLength”: 10,
in your js, the table will only display… 10 éléments smile

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. smile

 
Posted: 02 August 2012 01:58 PM   [ # 364 ]   [ Rating: 0 ]
Joined: 2011-03-24
22 posts

hi,

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 smile

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

have swing

 
Posted: 12 August 2012 12:50 AM   [ # 365 ]   [ Rating: 0 ]
Avatar
Joined: 2010-10-28
5 posts

hi,

it has been a long time since i’m not update my CI, datatables and ignited data tables.

since i’ve updated to datatables 1.9.3 with latest ignited-datatables from github, my table did not shows any data.

my firebug console shows error :

TypeErroraData is undefined
for ( var i=0iLen=aData.length i<iLen i++ ) 

and my json returned

{"sEcho":1,"iTotalRecords":68,"iTotalDisplayRecords":0,"aaData":[],"sColumns":"uid"


im not sure what caused this error.

 

 
Posted: 22 August 2012 07:16 PM   [ # 366 ]   [ Rating: 0 ]
Joined: 2012-04-04
2 posts

I’m having the same problem. Any answer?

Dermis - 12 August 2012 12:50 AM

hi,

it has been a long time since i’m not update my CI, datatables and ignited data tables.

since i’ve updated to datatables 1.9.3 with latest ignited-datatables from github, my table did not shows any data.

my firebug console shows error :

TypeErroraData is undefined
for ( var i=0iLen=aData.length i<iLen i++ ) 

and my json returned

{"sEcho":1,"iTotalRecords":68,"iTotalDisplayRecords":0,"aaData":[],"sColumns":"uid"


im not sure what caused this error.

 
Posted: 31 August 2012 02:54 PM   [ # 367 ]   [ Rating: 0 ]
Joined: 2011-12-28
1 posts

I need help, I’m using codeigniter 2.1 however use 3 types of database (mysql, mssql and oracle), must use the data tables in the three databases.

Could someone help me.

thank you

 
Posted: 01 September 2012 02:16 AM   [ # 368 ]   [ Rating: 0 ]
Avatar
Joined: 2012-07-19
32 posts
Dermis - 12 August 2012 12:50 AM

hi,

it has been a long time since i’m not update my CI, datatables and ignited data tables.

since i’ve updated to datatables 1.9.3 with latest ignited-datatables from github, my table did not shows any data.

my firebug console shows error :

TypeErroraData is undefined
for ( var i=0iLen=aData.length i<iLen i++ ) 

and my json returned

{"sEcho":1,"iTotalRecords":68,"iTotalDisplayRecords":0,"aaData":[],"sColumns":"uid"


im not sure what caused this error.

José Neto - 22 August 2012 07:16 PM

I’m having the same problem. Any answer?

I suspect this is a simple issue, in the JS where you initialize your datatable, try changing this line…

for ( var i=0iLen=aData.length i<iLen i++ ) 

...to this:

for ( var i=0iLen=aaData.length i<iLen i++ ) 

Your for loop is checking for the length of an array that doesn’t exist (notice the “aData.length” and “aaData.length”). Hope that helps. smile

 
Posted: 05 September 2012 01:51 PM   [ # 369 ]   [ Rating: 0 ]
Joined: 2011-08-28
34 posts

my tables are not being populated, instead it throwing me this error

DataTables warning (table id = ‘student_table’): Requested unknown parameter ‘1’ from the data source for row 0

Below is my js code

script type="text/javascript" charset="utf-8">
$(
document).ready(function() {
    
$('#student_table').dataTable{
        
"bProcessing"true,
        
"bServerSide"true,
        
"sServerMethod""POST",
        
"sAjaxSource""<?php echo base_url()?>index.php/data/all"
    
);            
);
[removed] 

when i directly access index.php/data/all i get the below result

{"sEcho":0,"iTotalRecords":3,"iTotalDisplayRecords":3,"aaData":[["85","t1","1D"],["74","test475","4A"],["777","maiz","5"]],"sColumns":"id,name,class"

 

below is my html table

<table class="datatable tables" id="student_table">
                            <
thead>
                                <
tr>
                                        <
th>ID</th>
                                        <
th>Name</th>
                                        <
th>Class</th>
                                </
tr>
                            </
thead>
                            <
tbody>
                                <
tr>
                                    <
td class="dataTables_empty">Loading data from server</td>
                                                                    </
tr>
                            </
tbody>
                        </
table

and below is my model

$this->load->library('datatables');

    
$this->datatables->select('admission,name,class');
    
$this->datatables->from('students');
    echo 
$this->datatables->generate(); 

for almost 4 days im trying to solve this problem.. can some one please help me.. any help will be appreciated

 

 
Posted: 08 September 2012 04:17 PM   [ # 370 ]   [ Rating: 0 ]
Joined: 2012-09-08
1 posts

livewirerules the fixed is in page 36.

 
Posted: 09 September 2012 06:11 PM   [ # 371 ]   [ Rating: 0 ]
Joined: 2012-09-09
1 posts

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


Code responsiblke for that error:

protected function input($field$escape TRUE)
    
{
      
if(isset($_POST['sEcho']) && isset($_POST[$field]))
        return (
$escape == TRUE)? mysql_real_escape_string($_POST[$field]) : $_POST[$field];
      elseif(isset(
$_GET['sEcho']) && isset($_GET[$field]))
        return (
$escape == TRUE)? mysql_real_escape_string($_GET[$field]) : $_GET[$field];
      else
        return 
FALSE;
    

How to change this code to be compatible with mysqli ?

 
Posted: 12 September 2012 02:51 PM   [ # 372 ]   [ Rating: 0 ]
Avatar
Joined: 2011-03-26
111 posts

hi solver,

i have just updated the native version of the library for that.. check it.

Regards..
Yusuf

 Signature 

Ignited Datatables
Nested Sets

 
Posted: 12 September 2012 05:26 PM   [ # 373 ]   [ Rating: 0 ]
Avatar
Joined: 2011-03-26
111 posts

i didnt like the latest changes of the library so i decide to continue from my latest commit..

So here is what ive done for today,

- Added group_by and like functions
- renamed ‘add_columns’ and ‘edit_columns’ functions to ‘add’ and ‘edit’. it is way more simple.

https://github.com/n1crack/Ignited-Datatables

note: The latest official datatables also includes distinct and or_where functions. It doesnt fit those functions in this library.
If you want to use or_where function simply :

->where(' (length = "46" OR length = "47") ' ,NULL,FALSE

 Signature 

Ignited Datatables
Nested Sets

 
Posted: 17 September 2012 04:08 AM   [ # 374 ]   [ Rating: 0 ]
Joined: 2012-09-17
1 posts

Hi all,

I have a problem with jquery datatables when I use group_by. The data loaded in the datatable are correct but records count shown in the footer of the datatable is bad. Can somebody help me with this?
Thanks

Matoo

 
Posted: 19 October 2012 05:44 AM   [ # 375 ]   [ Rating: 0 ]
Avatar
Joined: 2012-10-02
92 posts

Totally new to this. I want to use on the application I am developing. This is a great library. Can someone give me a working example? Or just a tutorial link? I also want to add 1 column at the end for actions(select/delete) thanks

 
25 of 30
25