Cascading works great when a person does the item selection. The key is that the _focus method of the List widget ( I guess an ancestor of ComboBox and DropDownList ) has this kernel:
that._select(li);
that._triggerCascade();
For the case of a programmatic selection via invocation of
.select(index)
.value(data-value)
.search(data-text)
In DropDownList
.select() will perform a ._select followed by a _triggerCascade
.value() will perform a .select(index) which will eventually do a _triggerCascade
.search() will perform a ._select only and not have a _triggerCascade
In v2012.3.1304 dropdownlist.js at line 272 there should probably needs to be a
Now suppose that you have three remote datasourced drop down lists to be populated and initialized based on text.
The search method could then be used in the databound callback to ensure DDL has its data before making the selection of the desired item.
p.s. Autogenerated cascading DDLs could be an alternate viewer for Hierarchical Data Source
that._select(li);
that._triggerCascade();
For the case of a programmatic selection via invocation of
.select(index)
.value(data-value)
.search(data-text)
In DropDownList
.select() will perform a ._select followed by a _triggerCascade
.value() will perform a .select(index) which will eventually do a _triggerCascade
.search() will perform a ._select only and not have a _triggerCascade
In v2012.3.1304 dropdownlist.js at line 272 there should probably needs to be a
if
(that._selectedIndex > -1) { that._triggerCascade() }
Now suppose that you have three remote datasourced drop down lists to be populated and initialized based on text.
The search method could then be used in the databound callback to ensure DDL has its data before making the selection of the desired item.
$.when ( $.get (
'/cgi/initialValues'
) )
.done ( loadDDL )
;
// initialValues is expected to output json of construct {DDL1:text1, DDL2:text2, DDL3:text3}
function
LoadDDL (initial) {
$(
'#DDL1'
).kendoDropDownList ({
dataSource: ...
databound:
function
(e) {
if
(initial.DDL1) {
var
text=initial.DDL1;initial.DDL1=
null
;e.sender.search(text);}}
});
$(
'#DDL2'
).kendoDropDownList ({
dataSource: ...
cascadeFrom:
'DDL1'
databound:
function
(e) {
if
(initial.DDL2) {
var
text=initial.DDL2;initial.DDL2=
null
;e.sender.search(text);}}
});
$(
'#DDL3'
).kendoDropDownList ({
dataSource: ...
cascadeFrom:
'DDL2'
databound:
function
(e) {
if
(initial.DDL3) {
var
text=initial.DDL3;initial.DDL3=
null
;e.sender.search(text);}}
change: doSomethingElse
});
var
doSomethingElse =
function
() {
// I can operate knowing the DDLs were populated and cascaded in a 1,2,3 manner
}
}
p.s. Autogenerated cascading DDLs could be an alternate viewer for Hierarchical Data Source