(SOLVED) TableTools.GetInstance does not carry the updated data table?

(SOLVED) TableTools.GetInstance does not carry the updated data table?

jvcunhajvcunha Posts: 81Questions: 10Answers: 1
edited February 2016 in Free community support

First:

The selected row :

column 10, value = 150

column 11, value = 100

var oTable = $('#myTable').dataTable();
oTable.fnUpdate('200', 1, 10, true);
oTable.fnUpdate('230', 1, 11, true);
$("td:eq(10)", nRow).html('200');
$("td:eq(11)", nRow).html('230');

in table is show correct.

After:

var oTable2 = TableTools.fnGetInstance('myTable');
var aData = oTable2.fnGetSelectedData();

loads the data before the update?

returns 150 and 100 when it should return 200 and 230

Can anyone help?

DataTables version: 1.10.7

TableTools version: 2.2.3

Replies

  • jvcunhajvcunha Posts: 81Questions: 10Answers: 1

    I found a solution:

    1. I create a var selected = [];
    2. On update row, add to selected array
    3. get selected array!

    code:

    var oTable = $('#myTable').dataTable();
    oTable.fnUpdate('200', 1, 10, true);
    oTable.fnUpdate('230', 1, 11, true);
    $("td:eq(10)", nRow).html('200');
    $("td:eq(11)", nRow).html('230');
    selected.push(oTable.fnGetData(1));
    

    after

    var aData = selected;
    
This discussion has been closed.