4 Answers, 1 is accepted
0
Hi Danielle,
Atanas Korchev
the Telerik team
We are not sure we understand your question. Please answer the following:
- Are you using Kendo UI for JSP or just Kendo UI (the jQuery plugins)?
- What do you mean by "I catch destroy event from grid, but I can't get the ID"? Can you provide your code?
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Daniele
Top achievements
Rank 1
answered on 27 Mar 2013, 12:37 PM
Sure, here there is the code in html
//In ${_jsonURLDelete} there is the url of the method
var ds = new kendo.data.DataSource({
transport: {
read: {
url: '${_jsonURL}', dataType: "json"
},
destroy: {
url: '${_jsonURLDelete}',
dataType: "json"
},
parameterMap: function(options, operation) {
if (operation !== "read" && options.models) {
return {models: kendo.stringify(options.models)};
}
}
},
schema: {
model: {
id: "id",
fields: {
id: { editable: false, nullable: true },
name: { validation: { required: true } },
surname: { validation: { required: true} },
city:{ validation: { required: true} }
}
}
}
});
$("#grid").kendoGrid({
dataSource: ds,
//change: onChange,
columns : [
{
field: "id",
title: "id"
},
{
field: "name",
title: "First Name"
},
{
field: "surname",
title: "Last Name"
},
{
field: "city",
title: "city"
},
{
command: ["edit", "destroy"], title: " ", width: "190px"
}
],
editable: "popup"
});
//*************************************
And here code in java (method is empty now)..
I have no idea, to know the Id of the model for delete, or new data for eventually update method
//*************************************
public static void renderClientDelete(Map<String, Object> model)
{
Map<String, String[]> val = params.all();
renderClient();
}
thanks a lot for all
//In ${_jsonURLDelete} there is the url of the method
var ds = new kendo.data.DataSource({
transport: {
read: {
url: '${_jsonURL}', dataType: "json"
},
destroy: {
url: '${_jsonURLDelete}',
dataType: "json"
},
parameterMap: function(options, operation) {
if (operation !== "read" && options.models) {
return {models: kendo.stringify(options.models)};
}
}
},
schema: {
model: {
id: "id",
fields: {
id: { editable: false, nullable: true },
name: { validation: { required: true } },
surname: { validation: { required: true} },
city:{ validation: { required: true} }
}
}
}
});
$("#grid").kendoGrid({
dataSource: ds,
//change: onChange,
columns : [
{
field: "id",
title: "id"
},
{
field: "name",
title: "First Name"
},
{
field: "surname",
title: "Last Name"
},
{
field: "city",
title: "city"
},
{
command: ["edit", "destroy"], title: " ", width: "190px"
}
],
editable: "popup"
});
//*************************************
And here code in java (method is empty now)..
I have no idea, to know the Id of the model for delete, or new data for eventually update method
//*************************************
public static void renderClientDelete(Map<String, Object> model)
{
Map<String, String[]> val = params.all();
renderClient();
}
thanks a lot for all
0
Daniele
Top achievements
Rank 1
answered on 27 Mar 2013, 12:39 PM
... - "Are you using Kendo UI for JSP or just Kendo UI (the jQuery plugins)?"
Now I use Kendo UI (the jQuery plugins), but I will use, all type of libraries will be necessary.
Now I use Kendo UI (the jQuery plugins), but I will use, all type of libraries will be necessary.
0
Hello Danielle,
Atanas Korchev
the Telerik team
The ID of the destroyed models should be available as argument of the destroy transport configuration. The parameterMap function should convert that data to JSON format. You can try logging what options are given to that function:
parameterMap: function(options, operation) {
if (operation == "destroy") {
console.log(options); // should contain the ID of destroyed items
}
}
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!