I have a drop down list using remote data with autoBind set to false. I can set the initial value and text for the drop down using the value and text properties just fine:
My issue is that the control does not seem to have a value until the data source is read. Before the data source is read, $("#ddlBuilding").val() returns NULL and ddlBuilding.value() returns undefined. Once a user clicks the drop down and the data source is loaded, both of these statements return the proper values.
If a user needs to make changes on a form to other fields, but not to this drop down, how am I to know the proper value if no selection is a valid choice? Is there a way to tell if the data source for the control has been read or not?
ddlBuilding = $(
"#ddlBuilding"
).kendoDropDownList({
width: 400,
height: 250,
dataTextField:
"Description"
,
dataValueField:
"Code"
,
value: myBuilding.Code,
text: myBuilding.Description,
optionLabel: {
Description:
""
,
Code:
""
},
dataSource: {
transport: {
read: {
dataType:
'json'
,
url: myServiceUrl
}
}
},
autoBind:
false
}).data(
"kendoDropDownList"
);
My issue is that the control does not seem to have a value until the data source is read. Before the data source is read, $("#ddlBuilding").val() returns NULL and ddlBuilding.value() returns undefined. Once a user clicks the drop down and the data source is loaded, both of these statements return the proper values.
If a user needs to make changes on a form to other fields, but not to this drop down, how am I to know the proper value if no selection is a valid choice? Is there a way to tell if the data source for the control has been read or not?