Error with Multiselect Defined in DIV Element

4 posts, 0 answers
  1. David
    David avatar
    2 posts
    Member since:
    Sep 2013

    Posted 13 Oct 2015 Link to this post

    We tried to upgrade from 2015.1.408 to 2015.3.1002.

     

    After the upgrade, we started experiencing errors with Kendo. After drilling in, we saw the following:  when a multiselect is defined using a "div" element we receive an exception on line 9457 of kendo.web.js 'Uncaught TypeError: Cannot read property 'length' of undefined'. After changing the element to a "select" the exception is not thrown and the page appears to load normally.

     

    We were unable to find any official release notes that suggested this was an intentional change.

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1796 posts

    Posted 15 Oct 2015 Link to this post

    Hello David,

    The MultiSelect widget is supported only when it is initialized from a SELECT element and this information is available in our online documentation:
    Can you please elaborate on the reasons behind using a DIV element for initializing the MultiSelect in the first place?


    Regards,
    Konstantin Dikov
    Telerik
     
    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. David
    David avatar
    2 posts
    Member since:
    Sep 2013

    Posted 15 Oct 2015 Link to this post

    At this point, we're more curious about what changed and why. It worked in our current version (2015.1.408), but no longer works.

    Is this an intentional change (so we must adapt our code) or is it a bug that will be fixed in the future?

     

    Here's a quick sample of what works in 2015.1.408:

    01.<div id="details">
    02.    <div data-role="multiselect"
    03.         data-value-primitive="true"
    04.         data-text-field="Name"
    05.         data-value-field="Id"
    06.         data-bind="source: Values, value: SelectedValueId">
    07.    </div> 
    08.</div>
    09. 
    10.<script>
    11.var model = new kendo.data.Model({
    12.        Values: [
    13.            { Id: 1, Name: 'test1' } ,
    14.            { Id: 2, Name: 'test2' }
    15.        ],
    16.                SelectedValueId: 1
    17.});
    18. 
    19.kendo.bind("#details", model);
    20.</script>
  5. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1796 posts

    Posted 16 Oct 2015 Link to this post

    Hi David,

    I can not elaborate on the reasons behind the change in the behavior, but the error that you are receiving is due to the fact that the internal logic of the widget is trying to traverse the options from the SELECT element used for the initialization. Since you are using a DIV element, there will be no options property and an error will be thrown.

    I have to say that this is something that is unlikely to be fixed, because it is mandatory to use SELECT element for the initialization and although that it was working with a div element in previous versions, it is not supported scenario and your implementation should comply with the widget requirements.


    Kind Regards,
    Konstantin Dikov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready