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

1 posts, 0 answers
  1. Alessandro
    Alessandro avatar
    3 posts
    Member since:
    Feb 2012

    Posted 26 Mar 2012 Link to this post

    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.
Back to Top