I have created a grid and I have needed to use a template to create the toolbar. I want to be able to batch edit then save back to the server.
If I weren't using a template I could simply use
If I weren't using a template I could simply use
toolbar: ["create", "save", "cancel"], To do what I need, however I need the template as I have a dropdown box in the toolbar and some other html. How do I tap into these events from a control inside my custom toolbar? Any help would be great!
3 Answers, 1 is accepted
0
Hello Shane,
Rosen
the Telerik team
In order to achieve the desired functionality through Grid's API, you should use the addRow, cancelChanges and saveChanges methods. Please refer to the methods tab in this example for more details on the methods in question.
All the best,Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Shane P
Top achievements
Rank 1
answered on 03 Feb 2012, 04:53 AM
Thanks Rosen that got me a little closer to what im trying to do.
I have hacked together some jquery to update some of the cell data and is working ok however I can't quite work out how to modify the items within the grid.
if I use the develop tools and look into my var model I can see the properties I want to update. How do I update these?
I assume if I update this and set the _modified property to true then the save event will pick up my changes? am I right?
I have hacked together some jquery to update some of the cell data and is working ok however I can't quite work out how to modify the items within the grid.
$("#apply-selected").live("click",function() {
var dd= $("#item-selector").data("kendoDropDownList");
var grid = $("#grid").data("kendoGrid");
console.log(reward.value());
if(dd.value()!='00000000-0000-0000-0000-000000000000') {
$('#grid >tbody :checkbox').each(function() {
if (this.checked == 1) {
var tr = $(this).parent().parent().parent();
// console.log(tr);
var td = tr.find(":last");
var dataItem = grid.dataItem(tr);
var model = grid.dataSource.get(dataItem.id);
console.log(model);
var h = "<
span
class
=
'k-dirty'
></
span
><
div
data-id=\'" + dd.value() + "'>" + dd.text() + "</
div
>";
$(tr).find("td").eq(4).html(h);
}
});
}
});
if I use the develop tools and look into my var model I can see the properties I want to update. How do I update these?
I assume if I update this and set the _modified property to true then the save event will pick up my changes? am I right?
0
Hello Shane,
Regards,
Rosen
the Telerik team
In order to modify a model values you should use its set method:
var
model = dataSource.get(id);
model.set(
"foo"
,
"bar"
);
// changes model foo field's value to bar
Regards,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!