fnDeleteRow problem
fnDeleteRow problem
I am having a problem with fnDeleteRow.
According to the API documentation (http://www.datatables.net/api): the inital input parameter is:
node (TR): the TR element that should be deleted from the table
or
int : Index of the row to delete from the aoData object (use the fnGetPosition() API function to find the index of a row in this array)."
My table looks like this:
[code]
Title
Edit
Delete
Bill Clinton
Edit
Delete
Capital
Edit
Delete
[/code]
It has been initialized like this:
[code]
$('#manage_tbl').dataTable({
"bJQueryUI": true,
"bAutoWidth": false,
"bLengthChange": false,
"bPaginate": true,
"sPaginationType": "full_numbers",
"bScrollCollapse": false,
"iDisplayLength": 20,
"oLanguage": {
"sSearch": "Filter:",
},
"aoColumns":[
{"sWidth": "50%", "bSortable": false},
{"sWidth": "5%", "bSortable": false},
{"sWidth": "5%", "bSortable": false}
]
});
[/code]
I have tried to use fnGetPosition in 2 different ways (the var did is equal to the portion of the row id following the "_"):
[code]
var pos = miTable.fnGetPosition($('#tr__' + did));
[/code]
and
[code]
var pos = miTable.fnGetPosition(document.getElementById('tr__' + did));
[/code]
In either case, I get a jQuery error ("nNode.nodeName is undefined") triggered at at jQuery line 1755:
[code]
if ( nNode.nodeName.toUpperCase() == "TR" )
[/code]
If I try without using fnDeleteRow by passing the node directly using the DOM or jQuery, the row is correctly identified (verified via Firebug) and I don't get an error, but the row does not get deleted:
[code]
miTable.fnDeleteRow(document.getElementById('tr__' + did));
[/code]
or
[code]
miTable.fnDeleteRow($('#tr__' + did));
[/code]
Puzzled. Can anyone help?
TIA
-DF
According to the API documentation (http://www.datatables.net/api): the inital input parameter is:
node (TR): the TR element that should be deleted from the table
or
int : Index of the row to delete from the aoData object (use the fnGetPosition() API function to find the index of a row in this array)."
My table looks like this:
[code]
Title
Edit
Delete
Bill Clinton
Edit
Delete
Capital
Edit
Delete
[/code]
It has been initialized like this:
[code]
$('#manage_tbl').dataTable({
"bJQueryUI": true,
"bAutoWidth": false,
"bLengthChange": false,
"bPaginate": true,
"sPaginationType": "full_numbers",
"bScrollCollapse": false,
"iDisplayLength": 20,
"oLanguage": {
"sSearch": "Filter:",
},
"aoColumns":[
{"sWidth": "50%", "bSortable": false},
{"sWidth": "5%", "bSortable": false},
{"sWidth": "5%", "bSortable": false}
]
});
[/code]
I have tried to use fnGetPosition in 2 different ways (the var did is equal to the portion of the row id following the "_"):
[code]
var pos = miTable.fnGetPosition($('#tr__' + did));
[/code]
and
[code]
var pos = miTable.fnGetPosition(document.getElementById('tr__' + did));
[/code]
In either case, I get a jQuery error ("nNode.nodeName is undefined") triggered at at jQuery line 1755:
[code]
if ( nNode.nodeName.toUpperCase() == "TR" )
[/code]
If I try without using fnDeleteRow by passing the node directly using the DOM or jQuery, the row is correctly identified (verified via Firebug) and I don't get an error, but the row does not get deleted:
[code]
miTable.fnDeleteRow(document.getElementById('tr__' + did));
[/code]
or
[code]
miTable.fnDeleteRow($('#tr__' + did));
[/code]
Puzzled. Can anyone help?
TIA
-DF
This discussion has been closed.
Replies
-DF
-DF
[code]
$('#tr__' + did)[0]
[/code]
for example.
Allan