Editor - what´s the difference with or without serverSide and processing?

Editor - what´s the difference with or without serverSide and processing?

asleasle Posts: 96Questions: 28Answers: 0

I am testing Editor and tweaked the examples for my own table data. I use the examples in the "controllers" folder. Now I wonder what happens when I leave out the two lines processing: true and serverSide: true? I checked in Chrome dev tools but could not see any difference. I thought this worked the way that e.g. I have 5000 records, it would only returne.g. 25 records and every filtering would also return 25 matching records and not the 5000, showing only 25.

   $('#example').DataTable({
        processing: true,
        serverSide: true,
        ajax: '../server_side/scripts/server_processing.php',
    });

And is there a difference between using DT Editor and using plain Datatables? I thought the main difference was the first block with new $.fn.dataTable.Editor... was for Editor and the second block $('#example').DataTable( {... was the same for both versions?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,144Questions: 26Answers: 4,736

    The Editor and Datatables are two different products. Datatables controls the display of the table. The Editor provides editing capabilities of the table.

    Enabling serverSide provides server side processing. Which means the server script is expected to perform all paging, sorting and searching functions. This is a client / server model and the protocol is descried here. The server side processing examples with this ssp.class.php. You can use it as is or modify to your needs. I believe this script comes as part of the Datatabes downloads.

    Kevin

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    Just to add:

    I leave out the two lines processing: true and serverSide: true? I checked in Chrome dev tools but could not see any difference

    Editor's server-side libraries will automatically detect if server-side processing has been enabled or not. If it has, then it will limit the response to the data for the current page. If it isn't enabled, then the server will respond with the full data set.

    If that isn't happening for you, my guess would be a cache issue, but we'd need a link to a page showing the issue to say for sure.

    Allan

  • asleasle Posts: 96Questions: 28Answers: 0
    edited June 2022

    Thanks, I am still confused. I am planning to use Editor for my projects since they require editing. Before I have used DataTables to only show table data. I have used server-side wcript with the ssp.class.php . In the Editor server-side example the server script does not use ssp.class.php. The only difference I can see is the serverSide: true option in js. And why is processing: true missing in the Editor example with server-side? So without that option (serverSide) the returned data contains all rows? Also I am changing the sql in the controller using this at the bottom of the page (for this table I only show records with field 'fuse' set to 1):

        ->where( 'fuse', "1" )
        ->process( $_POST )
        ->json();
    

    I have used the same sql call with only DataTables adding this in the js like in the Custom HTTP variables example

    And sorry but my examples are on a login page so I have to move it out to make it available. For now I am just asking :-) Btw. I purchased a Editor license even if I don`t understand everything. It seems great and I know I will master it. Just takes time :-)

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Answer ✓

    I have used server-side wcript with the ssp.class.php . In the Editor server-side example the server script does not use ssp.class.php.

    Correct - Editor's PHP libraries implement server-side processing themselves and don't need the SSP class.

    And why is processing: true missing in the Editor example with server-side?

    I just missed it! The processing indicator is simply a little notification to the user that something is happening during the Ajax request. It makes no difference to functionality.

    So without that option (serverSide) the returned data contains all rows?

    Correct.

    Allan

Sign In or Register to comment.