Changing data in aaData on the client side

Changing data in aaData on the client side

chris_nchris_n Posts: 53Questions: 3Answers: 0
edited April 2012 in General
I have a situation where I use DataTables and jEditable to display and edit data which is kept in memory client-side. Rather than having jEditable post back to the server, I have it call a function (see code snipet below). What I'm looking for is suggestions on how to update the data in aaData to reflect the changes made? As things stand, with the code below, the changes are maintained in the browser window, however, when I later "capture" the data (using oTable.fnGetData()) I miss the changes.

I'm not sure that fnAddData can be convinced to do this properly. Something along the lines of a fnUpdateData where the 2D location of the data along with the new data were passed in is more along the lines of what I need (I think).

So, considering there is no such function in DataTables at this time, can anyone suggest a workaround?

[code]

...

"fnDrawCallback": function(oSettings) {
/* Apply the jEditable handlers to the table on all fields w/o the no_edit id */
$('#quotes_editor tbody td[id!="no_edit"]').editable( function(value, settings) {
return(value);
},
{
"callback" : function( sValue, y ) {
oTable.fnDraw(false); /* no filter/sort or we lose our pagination */
},
"height" : "14px",
});
},

...

[/code]

Kind Regards,
Chris

Replies

  • allanallan Posts: 63,810Questions: 1Answers: 10,516 Site admin
    It sounds like fnUpdate is what you want - possibly combined with fnPosition to get the cell index from a TD/TH node. fnUpdate will simply update the data client-side - exactly what you want I think :-)

    Allan
  • chris_nchris_n Posts: 53Questions: 3Answers: 0
    Man! How did I miss that? ;-)

    Thanks again Allan.
This discussion has been closed.