Can't display a row after fnAddDataAndDisplay
Can't display a row after fnAddDataAndDisplay
grahampcharles
Posts: 20Questions: 1Answers: 0
I have a table that retrieves a Json array via Ajax. It allows editing and adding records via dialog edit forms. After an edit, I use API plugin code like this:
[code]
oTable.fnDisplayRow(oTable.fnGetNodes(index));
[/code]
(I've retrieved the index by stepping through fnGetData to find the key.) This works fine.
However, when I *add* a data row using code like this:
[code]
oTable.fnAddDataAndDisplay(row); // from the plugin
[/code]
..the row doesn't appear.
I've verified that the index is set correctly and the row exists. And I can filter for it with sSearch or fnFilter, or manually page through to it.
I believe this is because the nTr isn't going to exist on a row that's never been displayed -- so since oTable.fnSettings().aoData[index].nTr is null, fnDisplayRow(fnDisplayRow(oTable.fnSettings().aoData[index].nTr) is going to fail. The line in the plugin:
[code]
var nAdded = oSettings.aoData[ iAdded ].nTr;
[/code]
is also producing a null. iAdded is correctly calculated.
Any idea what's wrong with my new table row? Stepping through code now but if you happen to have seen this before...
Thanks!
g.
[code]
oTable.fnDisplayRow(oTable.fnGetNodes(index));
[/code]
(I've retrieved the index by stepping through fnGetData to find the key.) This works fine.
However, when I *add* a data row using code like this:
[code]
oTable.fnAddDataAndDisplay(row); // from the plugin
[/code]
..the row doesn't appear.
I've verified that the index is set correctly and the row exists. And I can filter for it with sSearch or fnFilter, or manually page through to it.
I believe this is because the nTr isn't going to exist on a row that's never been displayed -- so since oTable.fnSettings().aoData[index].nTr is null, fnDisplayRow(fnDisplayRow(oTable.fnSettings().aoData[index].nTr) is going to fail. The line in the plugin:
[code]
var nAdded = oSettings.aoData[ iAdded ].nTr;
[/code]
is also producing a null. iAdded is correctly calculated.
Any idea what's wrong with my new table row? Stepping through code now but if you happen to have seen this before...
Thanks!
g.
This discussion has been closed.
Replies
[code]
oTable.fnPageChange( 'last' );
[/code]
before the row navigation. But I'd love to know what I was doing wrong!