Data Table get disappeared on click of the header sorting
Data Table get disappeared on click of the header sorting
Hello Team,
I added below table structure in my project
Project Name | Project Number | Project Stage | Created By | Date Created | Date Last Modified | |
---|---|---|---|---|---|---|
Project Name | Project Number | Project Stage | Created By | Date Created | Date Last Modified |
i am creating the tr dynamically and appending it to the tbody by javascript.Every thing is fine here i can see all data also there in the data table but the problem is when i try to click on the sort or to search from the search box everything in the tbody get disappeared and i see only <td valign="top" colspan="6" class="dataTables_empty">No data available in table</td> in the tbody.
i am not doing any postback here.can somebody please help to get this issue sort.
Thanks in advance
Answers
After you add these records using JavaScript are you adding the data using DataTables row.add function? Here is a link to how to do this; https://datatables.net/reference/api/rows.add(). The data that DataTables manages is not always the same as what the data the DOM is using, especially when making changes to your data.
John
Hello John Thanks for reply,
I am using the tbody.append(tr) method to append the tr to the table by javascript dynamically.
I am not using the rows.add here.
How to use the rows.add method to add the txtboxes in the tbody of the Datatable when i try to use that i am getting the javascript exception for that.And
But how do i append my tr dynamicaly which contains the 5 td and in each td contains a input textbox control there.
i think textbox is the problem here that i added by javascript.
please see below is the code that i am using in my project
var tblCostByWkPkg = document.getElementById("Resource");
var tr = document.createElement("tr");
We'd really need a link to a test case showing the issue here. It sounds like you are trying to manipulate the table's HTML yourself rather than using the API, but really we'd need a test page showing it to understand what is happening.
Allan