ideas for improvement
ideas for improvement
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? :)
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? :)
This discussion has been closed.
Replies
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
[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 :)
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?
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
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! :)
Regards,
Allan