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

Editable grid cancel not working

1 Answer 129 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Khushali
Top achievements
Rank 1
Khushali asked on 18 Jul 2012, 11:17 AM
Hi,

I have created a Kendo grid, which is editable(inline). For the unique id(which we specify in "model" of grid definition), i have given a column name which has numbers(unique). Now, when the user adds a new row, this particular column has " " value. So, i myself add new values. Whenever some update or delete operations are performed, i need to perform some additional functionalities. So, i use this unique column values to retrieve the old/new row. Now, when i add a row, and update it, it works fine. But, then for the newly added row, if i click on "edit" and then click on "cancel", nothing happens. When i tried searching in source code, i could find that kendo generates some unique id internally, on adding new rows. But, when i click on cancel, the id that was generated by kendo is different. And it does not get the model itself. It is undefined. Can anyone suggest what should be done?

 _modelForContainer: function(container) {
            var id = (container.is("tr") ? container : container.closest("tr")).attr(kendo.attr("uid"));
            return this.dataSource.getByUid(id);
        },

In this piece of code(from kendo.grid.js), this.dataSource.getByUid(id) becomes undefined on click of cancel.

Regards,
Khushali

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 23 Jul 2012, 10:36 AM
Hi Khushali,

The uid attributes are generated on the client and are not constant - e.g. they change on each data bound. I would not recommend to use them as a model id substitute. When you add a new record, the server should generate and return back the record's id, so the dataSource would be able to update its internal data.

I am not sure if I understood your scenario correctly. Could you please provide a jsFiddle or jsBin example that demonstrates your current implementation?

Regards,
Alexander Valchev
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
Khushali
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or