Reload data

Reload data

gerennegerenne Posts: 30Questions: 0Answers: 0
edited March 2012 in DataTables 1.9
Hi!!

I've a data tables that is loaded with a simple array:

oTable =$('#table').dataTable( {
"aaData": a1,
"bFilter" : false,
"bRetrieve": true,
"bDestroy": true,
"aoColumns": [
{"mDataProp": 0},
{"mDataProp": 1},
{"mDataProp": 2},
{"mDataProp": 3},
{"mDataProp": 4},
{"mDataProp": 5},
{"mDataProp": 6},
{"mDataProp": 7}
],
"fnDrawCallback":
function() {
clickRowHandler();
}



} );

And when I press a button, I want reload the data of the table. I try with the clear function, but it remove all data, and not load the new data.

I've seem for others forums the function ajaxLoader, but I don't know if I can to use with a simple array.

Thanks and advance!!

Replies

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Use fnClearTable and fnAddData to achieve what you want - clear the table and then add the new data from whatever source you want - effectively giving a refresh.

    Allan
  • gerennegerenne Posts: 30Questions: 0Answers: 0
    Thanks a lot, Allan!!
  • gelbertgelbert Posts: 3Questions: 0Answers: 0
    I have a check box and images (buttons to trigger actions) in couple of columns besides text in other columns. How do I get checkbox and images to be inserted into new rows using fnAddData or any other API function for datatables 1.9.0?
This discussion has been closed.