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

Binding dropdownlist datasource does not work

2 Answers 221 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Jaap
Top achievements
Rank 2
Jaap asked on 07 Mar 2012, 04:15 PM
I have this HTML:
<select data-role="dropdownlist", data-bind="value: xxx", data-text-field="field1", data-value-field="field2", data-source='{"transport":{"read":"my-url"}}' />
Then I bind this template.
But the data-source is not used.

Found an issue in the function kendo.initWidget.
Inside that function there is the code:

if (dataSource) {
     options[
"dataSource"] =
window[dataSource];
}

dataSource does here indeed have the transport object I defined in the attributes. But window[dataSource] is undefined.
Seems to me that this line of code must be:

if (dataSource) {
     options[
"dataSource"] = dataSource;
}

When I change it this way, the dropdownlist works!
So not sure if this is a bug or that I am doing something wrong.

Regards, Jaap

2 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 08 Mar 2012, 10:53 AM
Hello,

 Thanks for bringing this up. Indeed the dataSource cannot be currently set like this. You can set it to the name of a data source variable:

var myDataSource = new kendo.data.DataSource();

<select data-role="dropdownlist", data-bind="value: xxx", data-text-field="field1", data-value-field="field2", data-source='myDataSource' /> 

Yet we can easily support both scenarios. We will implement this for the official release.

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!
0
Jaap
Top achievements
Rank 2
answered on 26 Mar 2012, 08:26 AM
I can confirm this is working now in the release version.
Thanks, Jaap
Tags
MVVM
Asked by
Jaap
Top achievements
Rank 2
Answers by
Atanas Korchev
Telerik team
Jaap
Top achievements
Rank 2
Share this question
or