Hi,
I am using parameterMap function in HierarchicalDataSource. At root level everything works as expected. But when it is called from nested datasource, then "type" parameter is undefined. I need mapping only for "create" request.
My treeview definition with datasource looks like this:
$("#tree").kendoTreeView({
dragAndDrop: true,
dataSource: {
transport: {
read: {
url: '@Url.Action("Read", "TreeView")'
},
update: {
url: '@Url.Action("Update", "TreeView")',
dataType: 'json',
type: 'POST'
},
create: {
url: '@Url.Action("Create", "TreeView")',
type: 'POST',
contentType: "application/json; charset=utf-8",
dataType: 'json'
},
parameterMap: function (data, type) {
if (type == "create") {
return JSON.stringify(data);
}
return data;
}
},
schema: {
model: {
id: "Id",
hasChildren: "HasChildren"
}
}
},
dataTextField: 'Name',
drop: onTreeviewDrop,
drag: onTreeviewDrag
});
Thanks for any help!
I am using parameterMap function in HierarchicalDataSource. At root level everything works as expected. But when it is called from nested datasource, then "type" parameter is undefined. I need mapping only for "create" request.
My treeview definition with datasource looks like this:
$("#tree").kendoTreeView({
dragAndDrop: true,
dataSource: {
transport: {
read: {
url: '@Url.Action("Read", "TreeView")'
},
update: {
url: '@Url.Action("Update", "TreeView")',
dataType: 'json',
type: 'POST'
},
create: {
url: '@Url.Action("Create", "TreeView")',
type: 'POST',
contentType: "application/json; charset=utf-8",
dataType: 'json'
},
parameterMap: function (data, type) {
if (type == "create") {
return JSON.stringify(data);
}
return data;
}
},
schema: {
model: {
id: "Id",
hasChildren: "HasChildren"
}
}
},
dataTextField: 'Name',
drop: onTreeviewDrop,
drag: onTreeviewDrag
});
Thanks for any help!