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

Error with Multiselect Defined in DIV Element

3 Answers 811 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 13 Oct 2015, 04:44 PM

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.

3 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 15 Oct 2015, 07:54 AM
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!
 
0
David
Top achievements
Rank 1
answered on 15 Oct 2015, 05:36 PM

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>
0
Konstantin Dikov
Telerik team
answered on 16 Oct 2015, 06:23 AM
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!
 
Tags
MultiSelect
Asked by
David
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
David
Top achievements
Rank 1
Share this question
or