How can I trigger fnServerData from an "external" button?
How can I trigger fnServerData from an "external" button?
I have a table that displays two sets of data using server-side processing and AJAX-updating (done like this: http://www.mccran.co.uk/examples/datatable/index.cfm)
To switch between my two datasets, I have a select element, which I added to the table layout. I now want to trigger fnServerData when the user selects a different dataset from the select menu.
Question is: Can fnServerData be triggered from "external" buttons?
I tried calling with a custom event fired on select-change and listening inside the respective tables fnInitComplete like so:
[code]
$(window).on('repaint_orders', function(){
$('.tbl_orders').fnServerData( sSource, aoData, fnCallback, oSettings );
});
[/code]
But that doesn't work, as all of the required variables aren't defined.
Is there a direct way to trigger an update/submit of the table?
To switch between my two datasets, I have a select element, which I added to the table layout. I now want to trigger fnServerData when the user selects a different dataset from the select menu.
Question is: Can fnServerData be triggered from "external" buttons?
I tried calling with a custom event fired on select-change and listening inside the respective tables fnInitComplete like so:
[code]
$(window).on('repaint_orders', function(){
$('.tbl_orders').fnServerData( sSource, aoData, fnCallback, oSettings );
});
[/code]
But that doesn't work, as all of the required variables aren't defined.
Is there a direct way to trigger an update/submit of the table?
This discussion has been closed.
Replies
If you are using server-side processing like in the article you linked to - then yes. Just call the API method fnDraw which will redraw the table and thus call fnServerData.
Allan