Im getting the following json response from the server.
[{"TaxYear":2014,"IsCurrentFlag":false},{"TaxYear":2013,"IsCurrentFlag":true},{"TaxYear":2012,"IsCurrentFlag":false}]
How do I set the selected item based on "IsCurrentFlag" where "IsCurrentFlag == true" ?
Below is my code to Create DataSource and Set the DropDownList.
var
taxYearsDS: kendo.data.DataSource = createDataSource(
"GetYears"
);
var
$taxYears: JQuery = $(
"#taxYears"
);
$taxYears.kendoDropDownList({
dataSource: taxYearsDS,
dataTextField:
"TaxYear"
,
dataValueField:
"TaxYear"
});
function
createDataSource(action: string): kendo.data.DataSource {
var
schema: kendo.data.DataSourceSchema;
return
new
kendo.data.DataSource({
type: type,
transport: {
read: {
url: svcUrl +
"/myapi/"
+ action,
dataType:
"json"
},
},
schema: schema,
serverFiltering:
false
});
}