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

MVVM now storing item as "[Object, object]" instead of the object

2 Answers 101 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 2
Veteran
Steve asked on 28 Aug 2017, 05:58 PM

Kendo updated with our last Sitefinity update, and previous to now it always stored the selected item in the list to the MVVM model.  However in the current version it seems to just store literally as the string "[Object, object]"

I've tried setting data-value-primitive to true\false, no change either way.

 

<select class="schedules form-control"
                                 data-bind="source: schedule, value: location.schedule, events: { change: onScheduleChange }, visible: hasScheduleItems"
                                 data-text-field="StartDateFormatted"
                                 data-value-primitive="false"
                                 data-role="dropdownlist"
                                 data-option-label="Select a schedule entry"
                                 style="width: 100%; max-width: 300px">
                            </select>

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 30 Aug 2017, 01:01 PM
Hello Steve,

On the following Dojo example a similar scenario to the one described is demonstrated (Kendo UI DropDownList MVVM) . With it, the binding works as expected and the selected model value is properly assigned.

In the currently provided example I have noticed that the data-value-field attribute is missing from the configuration options of the DropDownList, but is actually needed because it specifies the field of the current item to which the option value is bound. When the element options are created by the source binding, Kendo UI MVVM selects the option which corresponds to the View-Model value specified by the value binding. 

After adding the above mentioned attribute, you will notice that the issue is successfully resolved. Additional information on the topic can be found in the following Value Binding article

Regards,
Dimitar
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
Steve
Top achievements
Rank 2
Veteran
answered on 31 Aug 2017, 03:39 PM
Back in business, thx!
Tags
DropDownList
Asked by
Steve
Top achievements
Rank 2
Veteran
Answers by
Dimitar
Telerik team
Steve
Top achievements
Rank 2
Veteran
Share this question
or