I am new to Kendo component. In our project, we do not use the MVVM model because we adapt an existing application. We do a kind of face-lift with Kendo control. We have no problem to provide data to Combobox, calendar and some smaller control. But with the grid we hit a wall! ;-)
All object are quite complex with setter and getter and got several link to other object. I am not the "object part" programmer and I can't talk much on that. The point is that when I do:
The JS start a big big non stop loop. If I break the process and check in the stack windows of me firebug, I can see that KendoGrid try to do many many "Wrap" again the object. I think Kendo read the custom object and try to wrap it to Observable or something like that. Than Kenfo follow link to other objet and loop indefenitly.
Do I have a way to block that? Can I define manually with object to link. Example: Obj1.Title to column 1 and obj1.Name to column 2 ?
6 Answers, 1 is accepted
It is possible to tell KendoGrid or DataSource to not "wrap" the .father propertie?
I am afraid that what you would like to achieve is not supported. By design the DataSource is designed to operate with flat data structure. Many of the features which the component offers, such as filtering, sorting, grouping and etc. does not work with complex objects. Disabling the Observable's wrap method is not possible either - even though that you does not use MVVM, it is used internally by the framework logic/components.
If possible please try to transform the data into array of not nested objects. For example:
I hope this information will help.
Thanks for reply,
i do that and find a working solution.
Small question, my grid is in batch editing. I hook on the Save event to get the event when a user change something and leave the cell.
In the save event, I got the e.values containing the object of the cell changed like: Test=123.
I can do: myRealObject['test'] = e.values['test'] to save de change.
But in my case all the grid is created dynamically, I do not know the name of the protertie 'test'. I try to extract it with something like:
But propertyname is always undefined.
My suggestion is to hook up to the change event of the DataSource and listen for "itemchange" action. From the event parameters you can retrieve the name of changed field.
I hope this approach will fit in your scenario.
But like the sender is the dataSource and not the grid, I can't. Do I have a way to go up to the grid? My dataSource is not global and "integreted" in the grid. Or mayby I can add custom objet into the dataSource ?
Just for information, in the onChange event of the grid, the e.values is "PropertyNotEnumerable".
we need this to retreive name information:
you add it like:
and use it like: