Deleting multiple rows across pages
Deleting multiple rows across pages
saudagarrizwan
Posts: 8Questions: 1Answers: 0
Hi,
I have a datatable with paging. Table contains checkboxes on each row. I have only one delete button on top of the table. If user checks the check boxes and clicks on delete the rows will get deleted.
I have an issue here. If user selects few rows in first page, few in second and few in 3rd and click on delete, (suppose now user in 3rd page) rows getting deleted are from only 3rd page. 1st and 2nd are not getting deleted.
Below is the code am using.
[code]
for(var a = 0; a < aID.length; a++) {
var id = '#tr_' + aID[a];
oTable.fnDeleteRow(oTable.fnGetPosition($(id).get(0)));
}
[/code]
Here aID is the array of values of the rows and id is tr id.
Appreciate your help.
I have a datatable with paging. Table contains checkboxes on each row. I have only one delete button on top of the table. If user checks the check boxes and clicks on delete the rows will get deleted.
I have an issue here. If user selects few rows in first page, few in second and few in 3rd and click on delete, (suppose now user in 3rd page) rows getting deleted are from only 3rd page. 1st and 2nd are not getting deleted.
Below is the code am using.
[code]
for(var a = 0; a < aID.length; a++) {
var id = '#tr_' + aID[a];
oTable.fnDeleteRow(oTable.fnGetPosition($(id).get(0)));
}
[/code]
Here aID is the array of values of the rows and id is tr id.
Appreciate your help.
This discussion has been closed.
Replies
Allan
Thank you. But my [quote]aID[/quote] contains all the rows from all the pages. The thing is am not able to delete this by fnGetPoistion.
Am able to delete these by keeping the index. But if I select rows using check box and delete. Row is deleting but the above row is getting checked. Am not sure why it is showing as checked.
Allan