Problem with fnGetPosition following fnAddTr
Problem with fnGetPosition following fnAddTr
Hi,
I'm using fnAddTr in a table to add a row. The row is inserted as expected.
No second argument, so the plugin calls the internal _fnReDraw function.
When I now call fnGetPosition with the same row element, it returns null instead
of the row index. The index is needed for row deletion.
[code]
var new_row = $('FredFlintstone')
new_row.children('td').first().addClass('center') // Correct buglet in fnAddTr
oTable.fnAddTr(new_row[0])
var idx = oTable.fnGetPosition( new_row[0] )
[/code]
At this point idx is null.
Additional info:
oTable.fnGetNodes() and oTable.fnGetData() both return array *including* the added row!
DataTable v1.9.1
Any ideas for a workaround (other than fnAddData) ?
thanks,
Stefan
I'm using fnAddTr in a table to add a row. The row is inserted as expected.
No second argument, so the plugin calls the internal _fnReDraw function.
When I now call fnGetPosition with the same row element, it returns null instead
of the row index. The index is needed for row deletion.
[code]
var new_row = $('FredFlintstone')
new_row.children('td').first().addClass('center') // Correct buglet in fnAddTr
oTable.fnAddTr(new_row[0])
var idx = oTable.fnGetPosition( new_row[0] )
[/code]
At this point idx is null.
Additional info:
oTable.fnGetNodes() and oTable.fnGetData() both return array *including* the added row!
DataTable v1.9.1
Any ideas for a workaround (other than fnAddData) ?
thanks,
Stefan
This discussion has been closed.
Replies
Having said that, it should work, and I'm not sure why it isn't. An example would be really useful.
Allan
_fnNodeToDataIndex changed: in 1.8.2 is was traversing aoData (worked), in 1.9.1 it's looking at _DT_RowIndex on the node element, which is set in _fnCreateTr. Now fnAddTr calls _fnAddData, which I think does not set _DT_RowIndex ...
[code]
nTr._DT_RowIndex = iIndex;
[/code]
I had updated DataTables but not the plugin!
I do have longer term plans to make the plug-ins more version compatible - particularly now that they are in git :-)
Allan
Maybe add some links?