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

MVVM: Dropdown Value binding failing when DataSource is calculated field from ViewModel

1 Answer 151 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 16 May 2012, 11:38 AM
Referencing this Fiddle.  Which is only a slight modification of this earlier question.

Overview:
  • Select box is bound to a datasource from the viewmodel.  
  • The datasource is dynamic (not static, but represented by a calculated field in the viewModel).
Expected Results:
  • Select control contents are dynamically populated with data source via the ViewModel method.
  • Selected Dropdown Value is bound to the appropriate viewModel field.
Actual Results:
  • Dropdown box contents are dynamically populated with data source via the ViewModel method. - CHECK
  • Binding to ViewModel for Dropdown 

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 17 May 2012, 09:12 AM
Hi, 

There are two problems in that code:
  1. The dropDownList() function should be invoked.
  2. You should wrap the result of the dropDownList in ObservableArray if you want to use it in other methods.

Here is the updated jsFiddle: http://jsfiddle.net/korchev/Lvsqu/4/ 

Regards,
Atanas Korchev
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
Jay
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or