I am using a dropdown list that based on the selected item a second dropdown need to be cleared. Selecting an item from the UX fires the change event of the first dropdown and the second one will be cleared only if I trigger the change event manually. If I do that the value of the first dropdown does not get updated. I used select(-1) and value ("-1") and same behavior. Here is my code, I will appreciate any hint on this.
$(
"#ddl1"
).kendoDropDownList({
dataSource: [
{ value:
"1"
, text:
"Option1"
, priority: 0 },
{ value:
"2"
, text:
"Option2"
, priority: 1 },
{ value:
"3"
, text:
"Option3"
, priority: 1 }
],
dataTextField:
"text"
,
dataValueField:
"value"
,
optionLabel: { value:
""
, text:
"-- Select one --"
}
}).change(
function
(e) {
var
ddl2 = $(
"#ddl2"
).data(
"kendoDropDownList"
);
if
(
this
.value ==
"1"
) {
ddl2.value(
"-1"
);
//ddl2.select(-1);
//ddl2.trigger('change'); //with this value of ddl2 is cleared ("-- Select one --") and value of ddl1 does not change
}
else
{
/**/
}
validateSection(4);
});
$(
"#ddl2"
).kendoDropDownList({
dataSource: [
{ value:
"Y"
, text:
"Yes"
},
{ value:
"N"
, text:
"No"
},
{ value:
"NA"
, text:
"Refused to answer"
}
],
dataTextField:
"text"
,
dataValueField:
"value"
,
optionLabel: { value:
""
, text:
"-- Select one --"
},
}).change(
function
(e) {
validateSection(4);
});