programmatically send data from external form
programmatically send data from external form
thunderrabbit
Posts: 7Questions: 0Answers: 0
I'm using DataTables 1.8.2 to pull data from my server via ajax. The columns include a date field.
Once the table is loaded, I need to let the user select date ranges to filter the data since/before/between one/two dates. I'd like to have a couple of javascript calendars that will trigger the DataTable to refresh its data according to the dates selected.
I know how to do it with a page refresh: push values into aoData in the body of a function sent to parameter fnServerData when the table is defined... But I'd like to do it without refreshing the page each time.
I see fnDraw() will refresh the table, and I guess I could do some complex backend processing with fnFilter("2012-03-01/2012-03-31") but that's a hack I'd hate support long term. ;-)
How can I have the table send multiple values to the server to be processed after the table is initially loaded?
Once the table is loaded, I need to let the user select date ranges to filter the data since/before/between one/two dates. I'd like to have a couple of javascript calendars that will trigger the DataTable to refresh its data according to the dates selected.
I know how to do it with a page refresh: push values into aoData in the body of a function sent to parameter fnServerData when the table is defined... But I'd like to do it without refreshing the page each time.
I see fnDraw() will refresh the table, and I guess I could do some complex backend processing with fnFilter("2012-03-01/2012-03-31") but that's a hack I'd hate support long term. ;-)
How can I have the table send multiple values to the server to be processed after the table is initially loaded?
This discussion has been closed.
Replies
After the table is initially loaded, how can I ajax multiple values to the server and update the table based on the server response?
Lines 10, 12, and 14 seem to point toward the magic key I'm missing.
[code]
var aData = [];
this.oApi._fnServerParams( oSettings, aData );
oSettings.fnServerData( oSettings.sAjaxSource, aData, function(json) {
[/code]
Line 12 calls fnServerParams which will populate aData with its original values, right?
So I think my question now is how to tell fnServerParams to return new values at runtime?
[code]
myTable.aoData.push(nameValueArray);
[/code]