editor ajax submit,but new data can not draw on table,still show old one
editor ajax submit,but new data can not draw on table,still show old one
yugang.syg
Posts: 2Questions: 1Answers: 0
HI:
i want use editor.inline( this ) to update receive_number,and try to creat a static data to test ,but after call the successCallback function, the time_value is not show the new one ,i don't know why, who can help for me , thanks.
the main code like this:
editor = new $.fn.dataTable.Editor( {
ajax: function ( method, url, d, successCallback, errorCallback ){
$.ajax({
type: "POST",
url: url,
data: data,
dataType: "json",
success: function (json) {
var rel = {data: []};
var row = {"DT_RowId": "row_1","id": "1", "channel_id": "424242", "receive_number": "13845932121", "sms_content": "test", "reason":"test", "time_value":"2017-06-18 08:08:08", "connect": "connect"};
rel.data.push(row);
successCallback( rel );
},
});
},
table: "#resource_list_table",
idSrc: "DT_RowId",
fields: [ {
label: "time_value:",
name: "time_value",
type: 'datetime',
format: 'YYYY-MM-DD HH:mm:ss'
}
]
} );
$('#resource_list_table').on( 'click', 'tbody td.editable', function (e) {
editor.inline( this );
} );
table = $("#resource_list_table").DataTable(
{
"language": {
"url": "/plugins/datatables/Chinese.json"
},
"processing": true,
"serverSide": true,
"ajax": $.fn.dataTable.pipeline({
url : url,
pages: 5,
condition: ""
}),
"scrollX": true,
"columns": [
{"data": "id","visible": false},
{"data": "connect"},
{"data": "receive_number"},
// {"className": "editable"},
{"data": "time_value"},
{"data": "sms_content"},
{"data": "channel_id"},
{"data": "reason"}
],
"select": {
style: 'os',
selector: 'td:first-child'
},
"columnDefs": [
]
}
);
$.fn.dataTable.pipeline = function ( opts ) {
......ignore....
drawCallback(data);
}
}
};
$.fn.dataTable.Api.register( 'clearPipeline()', function () {
return this.iterator( 'table', function ( settings ) {
settings.clearCache = true;
} );
} );
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Are you sure that the id of the row being edited is
row_1
? If the id returned in the JSON response doesn't match the row that was edited, it wouldn't be able to update the row.Allan
HI,allan:
thank you for feedback me . i found that when serverside=true, edited rows will not be re-drawed. else is ok. can it be fixed? thanks
It appears to work without issue here. Perhaps you can link to a test case showing the issue.
Allan