|
<script>
$(function () {
var customAdaptor = new ej.ODataV4Adaptor().extend({ // Extend odatav4Adaptor
batchRequest: function (dm, changes, e, query) { // extend the batchrequest of ODataV4Adaptor
if (changes.changed.length >= 1) { // check the condition for any actions. Here I have checked for whether the changed is happened or not?. Likewise check for added and deleted too.
var response = {
changed: changes.changed, // get only the changed data
action: "batch",
table: e.url,
key: e.key
};
}
return {
type: "POST", // Send “POST” request to the controller
url: dm.dataSource.url, // send url (“odata/orders”) into post request and hence the $batch endpoint is removed
contentType: "application/json; charset=utf-8",
dataType: "json",
data: JSON.stringify(response) // response variable was passed to controller
};
}
});
var dataManager = ej.DataManager({
url: "/odata/Orders", // specify the odata controller
adaptor: new customAdaptor() //specify custom Adaptor
});
$("#Kanban").ejKanban(
{
dataSource: dataManager,
columns: [
{ headerText: "Backlog", key: "VINET" },
{ headerText: "In Progress", key: "QUICK" },
],
keyField: "CustomerID",
allowTitle: true,
fields: {
content: "ShipName",
primaryKey: "ShipVia"
},
allowEditing: true,
allowAdding: true
});
});
</script>
|