Add rows in a table after page 1 doesn't work
Add rows in a table after page 1 doesn't work
magarisiotis
Posts: 2Questions: 0Answers: 0
Hello..
i have the following problem:
I am trying to add new rows into a table, after a specific index. The user clicks on a row and then the app loads some rows that contain some info regarding that entry.
On the first page it works as expected. Beyond that point (page 2 and so on) it does not insert the new rows.
[code]
$('#jtable1').on('click','button_class',function() {
.....
$.each(jsonresult, function(i,item){
subentries = subentries + ' '+ item['info1'] +''+ '';
});
$('#jtable1 > tbody > tr').eq(rowIndex).after(subentries);
[/code]
i have the following problem:
I am trying to add new rows into a table, after a specific index. The user clicks on a row and then the app loads some rows that contain some info regarding that entry.
On the first page it works as expected. Beyond that point (page 2 and so on) it does not insert the new rows.
[code]
$('#jtable1').on('click','button_class',function() {
.....
$.each(jsonresult, function(i,item){
subentries = subentries + ' '+ item['info1'] +''+ '';
});
$('#jtable1 > tbody > tr').eq(rowIndex).after(subentries);
[/code]
This discussion has been closed.
Replies
Allan
I did find what i did wrong though. On the page 2 and so on, the index of each row wasn't the right one and i needed to recalculate it.
I did that by doing this:
[code]
var rowIndex = oTable.fnGetPosition( $(this).closest('tr')[0] );
rowIndex = rowIndex - oSettings._iDisplayStart;
[/code]