This is a migrated thread and some comments may be shown as answers.

Toggel edit mode by toolbar button

3 Answers 141 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Karl
Top achievements
Rank 1
Karl asked on 08 Feb 2012, 05:42 PM
Dear Forum,

I have been playing around with KendoUI in the past week. I like the ease of use. I have to admit that I am one of those that first needed Javascript and then started to lern it. Or you I say starts to.
I wanted for a mokeup create a grid with a button in the toolbar that toggels edit mode on and off.

var grid = $("#grid").kendoGrid({
dataSource: {
data: createRandomData(50),
schema: {
model: {
fields: {
FirstName: { type: "string", validation: {required: true} },
LastName: { type: "string", validation: {required: true} },
City: { type: "string", validation:{required: true} },
Title: { type: "string" },
BirthDate: { type: "date" },
Age: { type: "number", validation: {min:18, required:true} }
}
}
},
pageSize: 15
},
height: 500,
scrollable: true,
sortable: {
mode: "multiple"
},
toolbar: ansichtNichtEditierbar,
filterable: true,
pageable: true,
columns: [... ],
groupable: true,
editable: false,
}).data("kendoGrid");

Thus I defined the validations in the model and set editable to false. As you can see the toolbar is stored in anohter object.

var ansichtNichtEditierbar = [
{
text:"Editieren",
className:"k-grid-customEditieren",
imageClass: "k-add"
},
{
text:"Ansicht Speichern",
className:"k-grid-customAnsichtSpeichern",
imageClass: "k-add"
}
];

The idea being that I would bind a on click event to the button that will set editable to true and changes the toolbar to the edit mode on.

The binding is done with
$(".k-grid-customEditieren").on('click',function(){
});
To refresh I simply need to run grind.refresh() but I'm not able to get the edit mode to run.

3 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 10 Feb 2012, 09:20 AM
Hello Karl,

I am afraid that the Grid editable capabilities can only be set once in the options and cannot be changed once the Grid is initialized.

All the best,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Karl
Top achievements
Rank 1
answered on 10 Feb 2012, 12:41 PM
Hi Nikolay,

Thanks for your reply.

I'm sad to here that. I believe that to be a very nice feature. Sometimes when looking at your data you see something that needs quick editing. Jumping into editing mode and back again would make things much easier.
But I was thinking if it would be possible to save the state, a feature which is very important for us as we want to give our users the possibility to create there own "views", and re-load just the grid with the editable option set. If I remember correctly there was something about state changing in the forum.

Regards,
Karl
0
Nikolay Rusev
Telerik team
answered on 14 Feb 2012, 02:53 PM
Hello Karl,

Unfortunately toggle of editable state of the grid is not a trivial tasks it requires grid re-initialization, attaching/detaching various handler etc.

There isn't any other request for such feature and if there are more we will research if it is possible to implement it.

Regards,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Karl
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Karl
Top achievements
Rank 1
Share this question
or