Redraw table
Redraw table
Crowz4k
Posts: 1Questions: 1Answers: 0
I need to redraw table after some edit but it is now working here is my code what i am doing wrong?
function Success(response)
{
$("#info").hide();
$("#warning").hide();
if (!response.responseJson.isSuccess) {
$("#messageError").html(response.responseJson.Message);
$("#warning").show();
} else if (response.isEdit) {
var trCurrent = $("#" + response.model.Id);
var table = $("#example1").DataTable();
var rowdata = table.row(trCurrent);
rowdata.data()[0] = response.model.FirstName;
table.draw();
$("#messageInfo").html(response.responseJson.Message);
$("#info").show();
setTimeout(function () {
$("#Close").click();
},
1500);
} else {
var modelData = response.model;
ajaxAddNewRow(modelData,
function () {
$("#messageInfo").html(response.responseJson.Message);
$("#info").show();
setTimeout(function () {
$("#Close").click();
},
1500);
});
}
}
To be clear table wont update,new value wont show
This discussion has been closed.
Answers
Are you overriding the success function from the ajax option in DataTables?
Quote from
ajax
As per the forum rules please provide a testcase showing the issue.
We can help you a lot better if we can look at actual code that is causing the issue.
Since you are setting the data object directly rather than using the API to set the value, you need to tell DataTables that the value has changed. The
row().invalidate()
method can be used for that.Allan