ideas for improvement

ideas for improvement

the.ufonthe.ufon Posts: 3Questions: 0Answers: 0
edited November 2010 in General
As I browsing discussions, many of topics are related with server-side processing. It's usual type of using DataTable, so why don't improve it a little bit.. :)

Firstly I think it would be very useful have some way to send xhtml classes and ids for each row and cell directly in json data answer.. would be it problem to implement it as standart function? :)

Secondly, autoloading data through AJAX query after page is loaded is greatly ineffective. Wouldn't it be solved so that first page data for DataTable would be loaded as non-serverside processing directly from xhtml source and AJAX query would be needed when user want display the second page or filter data..? Actual way needs at last two queries to server (page loading, table data loading), for example in web pages based on Zend Framework it's relative very slow to request data.


What is your view for this? :)

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Hi the.ufon,

    For your first point - I presume that this is specifically about forms, or jEditable integration or something? The difficulty there is that every implementation will be slightly different, so I've left it open for the developer to do whatever it is that they want. The jEditable example should one way that it could be done: http://datatables.net/examples/api/editable.html and can be combined with server-side processing quite readily.

    Second point - agreed, generally speaking you might well want to only do the second page via Ajax, and this is possible at the moment by making use of the fnServerData callback function to stop the first draw that DataTables does. However, generally speaking this requires more work on the part of the developer, and most don't mind the extra XHR. So since this requires a bit more development from the developer to get the information into the table before the page load, and then also support XHR, the small amount of extra work for the DataTables changes is readily do-able :-)

    Allan
  • the.ufonthe.ufon Posts: 3Questions: 0Answers: 0
    ad 1. i didn't think just forms, more likely json data could be in more elaborate format, which would be used for some additional information than clear text - somethik like

    [code] "aaData": [ [ "cell-text1" , [ "c" : "my-cell-class" , "i" : "my-cell-id", "t" : "cell-text2" ] , "cell-text3" , "c" : "my-row-class" ]
    [/code]
    or some else :)

    ad 2. sure, loading of first page could be stopped by callback, but what i think it would be better to implement it into standart functions, because if i want to guarantee data for user also with disabled javascript, i must fill table directly when the page is loaded ( i think data without javascript should be available every time, so it isn't extra work for solid developers :) and when he implemented non-javascript version of tables ) so why loading data two-times :)
  • jelenjelen Posts: 1Questions: 0Answers: 0
    Hi men!
    I am actually implementing datatables into larger project and solving same issue as second point! Tables should works also when JS is off, paginating of non javascript version may be hidden when javascript is disabled, but now i have to load data twice per one load page.. it should be functionality of core definetely at least optionally.

    Classes and ids received from server could be also useful.

    allan, do you think would be problem to implement it into DataTables?
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    1. That's an interesting idea - and certainly worth considering. I'll look into that as an option for future expansion in DataTables. The ability to bind an abstract object to a column / row / cell is something I've been thinking about so this would fit in nicely.

    2. Here is a little initialisation script showing how it can be done - basically it enabled server-side processing after the first draw:

    [code]
    $(document).ready(function() {
    $('#example').dataTable( {
    "fnInitComplete": function ( o ) {
    o._iRecordsTotal = o.aiDisplayMaster.length;
    o._iRecordsDisplay = o.aiDisplay.length;
    o.oFeatures.bServerSide = true;
    o.sAjaxSource = "../examples_support/server_processing.php";
    }
    } );
    } );
    [/code]
    Allan
  • the.ufonthe.ufon Posts: 3Questions: 0Answers: 0
    oh mama! :)

    it's exactly what i kept in mind! thanks for easy solution! :)

    Ok, when do you plane to release next version, also are you going to implemet it instantly? :)


    Once more, thanks! :)
  • mgmg Posts: 47Questions: 0Answers: 0
    edited February 2011
    Is the ability to add a class to a from json available at this time, or is it still in the works?
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Currently it requires the use of fnRowCallback to add an ID or class as required (unless you are adding the same class to all cells in a column, in which case 'sClass' would do the job nicely). This is an area which could still be improved :-)

    Regards,
    Allan
This discussion has been closed.