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

Two-way binding for widget properties

1 Answer 84 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 02 Jan 2013, 11:45 PM
I was recently reviewing the Chart/API/Methods demo. Here is my understanding of the approach used in the demo:
  1. Thanks to event bubbling, the change event for the "configuration" div fires when any of the chart configuration settings change.
  2. The change event handler calls the refresh function, which scans all the current settings in the configuration div and refreshes the chart.
Is my understanding correct? If so, I was wondering if there are any alternative approaches for widget configuration that utilize Kendo MVVM. In other words, while I understand that HTML elements can be bound to each other using a ViewModel and the Kendo MVVM framework, I'm curious if a Javascript object property, such as a chart series type, can be bound to an HTML element, such as a radio button, in a similar manner.

A related question:
My ultimate goal is to create an app in which the user can configure a chart to his/her liking and then save that configuration to his/her ASP.NET profile. Does anyone know of any documentation or tutorials that explain how to save, say, a Kendo Stockchart configuration to a persistent data store?

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 04 Jan 2013, 01:36 PM
Hi Michael,

You understood correctly the example.
I am afraid that the widget configuration is not an observable object and cannot be bound directly to HTML elements. Moreover not all widgets can change their configuration at run time.

The widgets support initialization from the mark-up via data attributes (docs). 

Regarding your second question, saving the configuration settings is not supported out of the box. We have a code library project that demonstrates one possible implementation - storing settings in a cookie. The project uses Kendo Grid but I believe that you may find it helpful. 

Kind 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
MVVM
Asked by
Mike
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or