RefreshDataTable not working after deleting row from datatable in v1.10.15 ?
RefreshDataTable not working after deleting row from datatable in v1.10.15 ?
RameshKodam
Posts: 12Questions: 3Answers: 0
Written in delete success like this,
objDataTable1.RefreshDataTable("dtdynList");
This discussion has been closed.
Answers
.
What is the
RefreshDataTable
function? Is that one you've added yourself?DataTables 1.10 has a
ajax.reload()
method built in.Allan
Thanks for response,
Yes it's my own function.
I tried DataTables 1.10 ajax.reload() too, but not working as expected.
I need to refresh the datatables after deleting the row in datatable dynamically .
which function I need to use ?
You are going to have to give me a lot more information than that I'm afraid. Ideally a link to the page showing the issue, per the forum rules.
For example is there an Ajax error, or a Javascript error happening? Are you making an Ajax call to delete the row and then you want to reload the table? Are you using the
ajax
option to load the table? Give me something to work with .Allan
Thanks fro great response,
I am using ajax call to delete the record from datatables ,in delete success method I am using ajax.reload() to reload the table.
code:
$.ajax
({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "/WebServices/Common/DynamicFormService.asmx//DeleteRecordDelete",
data: "{objDataTable1.GetSelectedRowIDs("dtdynList") }",
success: function (data) {
var table = $('#dtdynList').DataTable();
table.ajax.reload()
error: function (x, e) {
alert("error");
}
});
Even if I use ajax.reload() deleted record also showing in the table but record deleted in database.When I attempt hole page refresh then showing fresh data.
suggest me if anything I am missing.
Right - so you aren't using DataTables' own
ajax
option. In that caseajax.reload()
is basically meaningless since DataTables doesn't have any Ajax information with which to make a request to!If you have the data yourself, use
clear()
to remove the old data from the table and thenrows.add()
to add the new data. Finally usedraw()
to draw it.Allan
In my above code how to use clear(),rows.add() and draw() functions
can you provide the code plz?
Not difficult
Allan
I don't have data,in this case how do I refresh the datatables ?
because I am getting error when I refresh the datatables in _fnCalculateColumnWidths method
headerCells[i].style.width = column.sWidthOrig !== null && column.sWidthOrig !== '' ?
_fnStringToCss(column.sWidthOrig)
Here HeaderCells showing as undefined, so getting error.
And also I want the paging buttons like arrow icons instead of "first","next","last","previous" text , where do I need to change these buttons.
any suggestion plz?
Thanks
I'm not sure you would. What would you refresh it with if you don't have new data?
Happy to look at a test case showing the issue.
Allan
Hello
After deleting it returning "OK".
So now how to do?
What was returning okay? What do you want to do next? Please link to a test case showing the issue with a full description of the issue.
Thanks,
Allan