Passive dataTable
Passive dataTable
Hi, Allan! I didn't found an answer for my issue in forum. So don't blame me for my question too hard =).
I have an architectural approach that forces me to make my dataTable passive. I have a manager on a page - some kind of an observer+mediator. This manager gets a set of data from a server and distributes it to a collection of controls on a page. Among that collection is my dataTable. So my dataTable has to receive a ready array of data and treat with it like a fnCallback does in fnServerData:
[code]
"fnServerData": function ( sSource, aoData, fnCallback, oSettings ) {
oSettings.jqXHR = $.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": function(response){
//do some work here
fnCallback(response);
}
} );
[/code]
As I see there is a way to use fnAddData. But it's quite not comfortable. And I have to update number of selected rows, total rows, update page number and so on.
I found a way to make it, but it's a hack. And I would like to avoid hacks =).
Is there any way to do it with standard tools?
Thanks, Alex.
I have an architectural approach that forces me to make my dataTable passive. I have a manager on a page - some kind of an observer+mediator. This manager gets a set of data from a server and distributes it to a collection of controls on a page. Among that collection is my dataTable. So my dataTable has to receive a ready array of data and treat with it like a fnCallback does in fnServerData:
[code]
"fnServerData": function ( sSource, aoData, fnCallback, oSettings ) {
oSettings.jqXHR = $.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": function(response){
//do some work here
fnCallback(response);
}
} );
[/code]
As I see there is a way to use fnAddData. But it's quite not comfortable. And I have to update number of selected rows, total rows, update page number and so on.
I found a way to make it, but it's a hack. And I would like to avoid hacks =).
Is there any way to do it with standard tools?
Thanks, Alex.
This discussion has been closed.
Replies
Thanks, All
PS
Good work Allan =)
Allan
Thank You for Your reply! =).
I need to have a posibility to push data into a grid and trigger all events that will update row data, info (10 of 1000 rows are slected), paging info ( << 10 11 12... 30 >>). But with calling a single method. Like it's done in fnServerData when the fnCallback is called.
So, I expected to have something like [code]oTable.update(response)[/code]. Where response is [code]
{
aaData: […],
iTotalDisplayRecords: 10,
iTotalRecords: 1000,
sEcho: "2"
}
[/code]
Sorry for my English =)
Allan
Alex