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

MVVM in a GRID-FORM scenario (with combobox inside the form)

0 Answers 74 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Alessandro
Top achievements
Rank 1
Alessandro asked on 26 Mar 2012, 11:45 PM
Hi,

I've the following scenario:
1) A ViewModel object with a remote datasource inside:
vm = kendo.observable({
  selected_row:
null,
  grid_rows:
new kendo.data.DataSource ({...})
});

2) A datasource outside the viewmodel:
combobox_values = new kendo.data.DataSource (...);

3) All the fields of a form are binded to vm, but take a look into this one:
js: kendo.bind($('#my_form'), vm);
html: <select id="some_id" data-value-field="id" data-text-field="description" data-bind="value: selected_row.field" data-role="combobox"></select>


where the data has the following structure:

selected_row = {field: {id: 1, description: 'something'}}

My questions are:
Q1) Is there a way to make this 'select' field to retrieve remote data using the combobox_values datasource? (look that this select field is already binded to the ViewModel vm.

Q2) Why the combobox component shows the field 'id' in the form instead the field 'description'? Look that the fields are declared in the html select element.

I appreciate any help,
Thaks,
Alessandro.

PS: Using the latest 2012 official kendoui web version.

No answers yet. Maybe you can help?

Tags
MVVM
Asked by
Alessandro
Top achievements
Rank 1
Share this question
or