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

Cascade of virtualized DropDownLists

1 Answer 118 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 04 Feb 2016, 11:00 PM

Using DropDownList elements that use virtualized data sources, is it possible to set (or reset) the values programatically?

 In our scenario we have 3 fields (DropDownList elements) which we need to re-set via another event.  Each field needs to use the previous fields contents to run through the virtualization mappers to get it's allowable contents.  Using an API method I'm retrieving the 3 values which should be set into the UI. However, I have yet to find a way to set all 3 values via javascript in the browser. It appears that I'm running into timing issues where the dataSource.read() has not yet come back with the allowed values prior to setting those values via script code.

 Basically I'm looking for some guidance on how to make cascaded virtualized drop down lists where I can set the values from some external event such as the click of a button.

 Things I've tried so far:

1. Simply setting the value using $('#identifier').data('kendoDropDownList').value('some value'); <== Can't set the value since it doesn't exist in the data() elements

2. Calling the read method of each drop down first via $('#identifier').data('kendoDropDownList').dataSource.read(), then setting the value (timing issue?) <== same issue as 1 since the read hasn't finished yet.

3. Hacking the jqXHR object which appears to hang off the dataSource.read() method (again timing issue?)

       $('#identifier').data('kendoDropDownList').dataSource.read().done = someOtherFunction <== where 'someOtherFunction' actually does the .value() setting, this does actually run the method, but again... timing

4. Adding the necessary element to the data via the .add method, setting the value, then doing the read <== this "appears" to work but the value isn't actually selected after the read returns. Clicking on the dropdown has the placeholder element selected rather than the value

 When the user manually interacts with each field I don't have any issues with having the fields set.  It's only when trying to do this all via custom javascript code that I'm running into issues.

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 09 Feb 2016, 08:39 AM
Hello James,

I prepared a simple test demo, using our Dojo service, in order to replicate the issue, but to no avail: I am sure that I am missing something specific. Could you modify the demo or send us a separate test page that replicates the issue? Thus we will be able to review the issue locally and find a feasible workaround faster.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
DropDownList
Asked by
James
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or