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

Setting Column Values to an array in my view model - using MVVM

4 Answers 124 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 2
Jay asked on 22 May 2017, 10:47 PM

Hi, we are using MVVM as much as possible in all of our KendoUI Implementations.  We've run into what seems to be a limitation of the Grid control.  The MVVM support for the column values field does not appear to support view model binding.  I am not able to reference arrays or data sources in the view model while creating the view. Here's a link to my jsFiddle that illustrates the issue.

If you remove "values: dsStatus" from the HTLM code for the status column, the grid instantiates just fine.  With it in there, an error is raised that dsStatus could not be found.  Any help with this that does not require me abandoning the MVVM pattern and instantiating the grid via javascript would be greatly appreciated.

4 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 24 May 2017, 01:10 PM

Hello Jay,

I am afraid that such syntax is not valid and the data-columns should be defined as plain JSON object. The values can be set to a global object as shown in the http://dojo.telerik.com/OVILE example, but they can not be part of the view model. 

Regards,
Boyan Dimitrov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Jay
Top achievements
Rank 2
answered on 24 May 2017, 03:32 PM

Thanks for your reply.  That will work as a work around.  However, it's quite odd that everything else in the KendoUI MVVM implementation binds against the view model.  As you know, it's generally considered poor practice to rely on global variables in your applications and yet that's our only option in this case.  It seems that this is an oversight and should be addressed at some point?

How would I go about making the suggestion formally?

0
Konstantin Dikov
Telerik team
answered on 26 May 2017, 01:28 PM
Hi Jay,

You could create a feature request in our public portal, where other developers can vote for it and increase its priority:

Best Regards,
Konstantin Dikov
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Jay
Top achievements
Rank 2
answered on 26 May 2017, 02:56 PM
Will do, thanks!
Tags
Grid
Asked by
Jay
Top achievements
Rank 2
Answers by
Boyan Dimitrov
Telerik team
Jay
Top achievements
Rank 2
Konstantin Dikov
Telerik team
Share this question
or