Why doesn't the table update after add new
Why doesn't the table update after add new

The application for a new user works as far as entering and validating the data and sending it to the server. But the table does not update to show the newly added data. The postSubmit function is as below.
editor.on('postSubmit', function (e, json, data, action) {
console.log("In postsubmit" + action);
if (action === "create") {
json.data = [JSON.parse(json.d)];
}
});
A cut and paste from my debugger of the returned data after json.data = [JSON.parse(json.d)]; looks like this..
0:
data:
ENABLED: "1"
FIRSTNAME: "ut"
LASTNAME: "ation"
SALUTATION: "sal"
USERNAME: "user1"
id: 5
proto: Object
proto: Object
length: 1
proto: Array(0)
And the entire create call looks like this..
$(document).ready(function () {
editor = new $.fn.dataTable.Editor({
idSrc: "id",
ajax: {
create: {
url: "UserList.aspx/AddUser",
type: "POST",
dataType: "json",
contentType: "application/json;charset=utf-8",
data: function (d) {
return "{ 'json': '" + JSON.stringify(d) + "' }";
}
},
table: "#userListGrid",
},
fields: [{
label: "Salutation:",
name: "SALUTATION"
}, {
label: "First Name:",
name: "FIRSTNAME",
attr: { required: true }
},
{
label: "Last Name:",
name: "LASTNAME"
}, {
label: "User Name:",
name: "USERNAME"
}, {
label: "Enabled?:",
name: "ENABLED"
}]
});
Answers
duplicate of this thread.