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

Custom editor and batch mode - cell showing old/incorrect value after selecting from DropDownList

1 Answer 137 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aleks
Top achievements
Rank 1
Aleks asked on 18 Feb 2013, 09:19 AM
I'm following the example here: http://demos.kendoui.com/web/grid/editing-custom.html

The only difference is that I'm getting my grid data from a REST service.

The grid displays fine, and when I click the appropriate cell I get a dropdown with all the options as I would expect. However when I select a value, the grid now displays "undefined" in the cell.

I'm assuming the example works because the data is local, and it's updating the underlying data set of the grid, however I don't want to update the underlying data on every edit... I want to batch the changes.

In the old non Kendo ASP.NET MVC days one had to implement a painful workaround that found and changed the actual text of the TR in the grid DOM once a value had been selected... I'm hoping this is no longer the case?

I've seen other posts with the same issue, however the usual answer is "use a ForeignKey column"; however that's not an option in my case, as it can only support local data for the lookup values and I need to get them from a server. There is an example out there that shows how to obtain the lookup values from a server and store them in a local var for use, however the example assumes that you only have one field you want to bind, because it uses the change event to bind the grid, which won't work if I have many FK lists to obtain (as I do)

1 Answer, 1 is accepted

Sort by
0
Aleks
Top achievements
Rank 1
answered on 18 Feb 2013, 10:31 PM
I worked out a solution using a template function to lookup the text for the corresponding new value...

http://jsbin.com/uvexef/2/edit

As it turns out, I have to reference the data used in my DropDownList anyway (which means I can't use a data source and have to pre-fetch the data using deferreds), so I may as well have used a Foreign Key column.

Ideally the Foreign Key functionality would support remote data... but until it does I think this is the only way to do it.
Tags
Grid
Asked by
Aleks
Top achievements
Rank 1
Answers by
Aleks
Top achievements
Rank 1
Share this question
or