Hi
I don't really know Kendo UI very well but I'm modifying an existing application that was written almost entirely in Kendo UI. Normally, making small changes by studying and re-purposing existing bits of code works fine for me. However, I have found an issue that I can't get past and I need help with.
I have a screen that lists a bunch of people in a kendo.grid. There is an edit button for each row that launches a popup in which there are a bunch of checkboxes that can be checked. Then on update I will send that data to the server for processing.
However, in the popup, when I press update, the datasource: transport: update: clause isn't firing. (For info, the datasource: transport: read: clause fires perfectly).
So, here is the code. Can anybody see where I have made any mistakes?
(For info, I have pasted below just the grid code, but I have also put in attachment the entire JS page, in case it's helpful).
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
function setGrid() {
var command = {};
dataSource = new kendo.data.DataSource({
serverFiltering: false,
serverSorting: false,
serverPaging: false,
sort: {
field: 'per_name',
dir: 'asc'
},
transport: {
read: {
url: 'action.cfm?action=filehandler.list',
dataType: 'json',
cache: false
},
update: {
url: 'action.cfm?action=filehandler.save',
dataType: 'json',
cache: false
}, // THIS NEVER FIRES
parameterMap: function (options, operation) {
console.log(operation);
console.log(options);
if (operation !== 'read') {
return options;
}
}
},
pageSize: 20,
schema: {
model: {
id: 'login',
fields: {
login: {
editable: false
},
per_name: {
editable: false
},
org_name: {
editable: false
},
//lst_user_sec_ids: {
// editable: true
//},
lst_user_sec_labels: {
editable: false
}
}
}
},
change: function (e) {
if (e.action === 'sync') {
lists.loadFilehandlers();
this.read();
}
},
error: function (e) {
app.printMessage({
restError: e.xhr
});
}
});
$screen.find('#filehandler-grid').kendoGrid({
dataSource: dataSource,
sortable: true,
cache: false,
noRecords: true,
pageable: {
pageSize: 20,
pageSizes: [20, 50, 100],
refresh: true,
info: true
},
filterable: {
extra: false,
mode: 'row',
operators: {
string: {
contains: 'Contains'
},
number: {
eq: 'Equals'
}
}
},
editable: {
mode: 'popup',
template: kendo.template($("#sectors-editor").html())
},
edit: function (e) {
$(e.container).parent().css({
top: '50px',
left: '150px',
width: '850px',
height: '600px',
overflow: 'scroll'
});
},
resizable: true,
selectable: 'cell',
columns: [
{
field: 'login',
title: 'ECAS ID',
hidden: true,
type: 'string',
filterable: {
cell: {
showOperators: false
}
},
width: '150px'
},
{
field: 'per_name',
title: 'Name',
hidden: false,
filterable: {
cell: {
showOperators: false
}
}
},
{
field: 'org_name',
title: 'Unit',
hidden: false,
type: 'string',
filterable: {
cell: {
showOperators: false
}
}
},
{
field: 'lst_user_sec_labels',
title: 'Has access to sectors',
hidden: false,
type: 'string',
filterable: {
cell: {
showOperators: false
}
}
},
{
field: 'lst_user_sec_ids',
title: 'hide this later',
hidden: false,
type: 'string',
filterable: {
cell: {
showOperators: false
}
}
},
{
command: [
{
name: 'edit',
text: {
edit: 'Edit',
cancel: 'Cancel'
},
click: function(e) {
// prevent page scroll position change
e.preventDefault();
// e.target is the DOM element representing the button
var tr = $(e.target).closest("tr"); // get the current table row (tr)
// get the data bound to the current table row
var data = this.dataItem(tr);
// Get the data for the list of sectors and write it into the popup window
setSectorsList(data.login, data.lst_user_sec_ids);
}
}
],
title: 'Actions',
width: '225px',
filterable: false
}
]
});
}