How to create new row in middle of the data table
How to create new row in middle of the data table
dhanu
Posts: 12Questions: 0Answers: 0
Now I am able to create new row at end of the data table, but my intentions is evry row has one plus button is there, if user click the button then create next row of the table
Please help
Please help
This discussion has been closed.
Replies
Allan
My question, after adding new row, rows counts are updated in pagination but not visible in table.
anything missing
$("#sellIn").dataTable({
"sPaginationType": "full_numbers",
"bPaginate": true,
"bJQueryUI": true,
"bAutoWidth": true,
"bFilter": false,
"bSort":false,
//"aaSorting": [[0,'asc']],
//"aaSortingFixed":[ [0,'asc']], // to force sorting for first column
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 0 ] }
]
//"aaSorting": [[1, 'asc']]
});
var oTable = $("#sellIn").dataTable();
var oSettings = oTable.fnSettings();
var oData = $('#sellIn').dataTable().fnSettings().aoData;
var oDisplayMaster = $('#sellIn').dataTable().fnSettings().aiDisplayMaster;
var oDisplay =$('#sellIn').dataTable().fnSettings().aiDisplayMaster;
var affectedRowNbr = 1; //childTd.parentNode.parentNode.rowIndex-1;
var ind = affectedRowNbr+1;
//var aData = oData[affectedRowNbr]._aData;
var newRow = " ";
newRow += "test0test1test2test3test4test5";
newRow += "";
//var newRowData = $(newRow)[0];
var nTr = $(newRow)[0];
var nTds = nTr.getElementsByTagName("td");
var aData = [];
for ( var i=0 ; i
Allan
You are modifying DataTables internal variables in the settings object. Modifying these values externally is absolutely not supported. You need to be very careful when doing that, since it will have knockout effects. Also be aware that the settings object can, will and does change between versions.
If you want a row to be inserted into a specific location in the table, use the ordering options the table provides. That is the only form of row ordering DataTables supports.
Allan
I tried same as ordering dataTables but not working.
any other solution is there
Allan