Binding dropdownlist datasource does not work

3 posts, 1 answers
  1. Jaap
    Jaap avatar
    96 posts
    Member since:
    Oct 2012

    Posted 07 Mar 2012 Link to this post

    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. Answer
    Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 08 Mar 2012 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Jaap
    Jaap avatar
    96 posts
    Member since:
    Oct 2012

    Posted 26 Mar 2012 Link to this post

    I can confirm this is working now in the release version.
    Thanks, Jaap
Back to Top