How to use editor in JSON object for CRUD operation?code attached below.
How to use editor in JSON object for CRUD operation?code attached below.
Rajiv687053
Posts: 1Questions: 1Answers: 0
var editor = new $.fn.dataTable.Editor({
"ajax": "/api/staff",
"table": "#MangerGrid",
fields: [
{ label: "Manager Enterprise Id:", name: "MEid" },
{ label: "Domain:", name: "MFA" }
]
});
//Bind Managers Gried
function bindManagerGried() {
$.ajax({
"dataType": 'json',
"contentType": "application/json; charset=utf-8",
"type": "GET",
"url": "http://p2b-429sx9s/sites/coxspa/_layouts/AddResourceWebPart/CoxTimeEntryWebService.asmx/GetManagers",
"success":
function (msg) {
var str = msg.d;
var json = eval('(' + str + ')');
$("*[id$='tdManager']").html('<table id="MangerGrid" class="display" style="width: 100%;"></table>');
$("*[id$='MangerGrid']").dataTable({
"sDom": 'T<"clear">lfrtip',
"oLanguage": {
"sZeroRecords": "No records to display",
"sSearch": "Search"
},
"bProcessing": true,
"bPaginate": true,
"sPaginationType": "simple",
"scrollCollapse": false,
"aaData": json.aaData,
"aoColumns": [
{ "sTitle": "Manager Enterprise Id", "sClass": "alignCenter" },
{ "sTitle": "Domain", "sClass": "alignCenter" }
],
"tableTools": {
"sRowSelect": "single",
"aButtons": [
{ "sExtends": "editor_create", "editor": editor },
{ "sExtends": "editor_edit", "editor": editor },
{ "sExtends": "editor_remove","editor": editor }
]
}
});
}
});
}
This discussion has been closed.