The situation is follow: we have a kendo grid with columns, in one column we have a kendo dropdown for filtering purposes. Client side based on angularjs, server side on c#. So, is it possible to set default value for kendo dropdown without knowing it's id? I'm searching the second day and cant find anything in web/teletrik documentation.
Code
$scope.GridOptions =
{
pageable: { refresh: true, pageSizes: true },
columns: [
// other columns here
{
field: "RegistrationStatus", title: "Status", width: 13,
filterable: {
operators: {
string: {
eq: "Is equal to",
neq: "Is not equal to"
}
},
ui: function(element) {
element.kendoDropDownList({
dataSource: [
{ Name: "Registered", Value: "PassedInterview" },
{ Name: "Pending", Value: "PassedInterview" },
{ Name: "Rejected", Value: "Rejected" }
],
dataTextField: "Name",
dataValueField: "Value",
optionLabel: "--Select Status--"
defaultValue: "PassedInterview" // smth like this, is this possible? or achieve in any other methods instead of taking dropdown id, which I dont know because this is hided inside
});
}
}
}
],
sortable: true,
filterable: true,
selectable: 'row',
editable: 'inline'
};
I made it to work setting the value
after its initialization:
element.data("kendoDropDownList").value("PassedInterview");
Demo. Note that you can also use select()
method if you like.
The problem is, idk why but you can't call it right after the widget creation, you have to use window.setTimeout()
. I know, its ugly. But somewhere between the creation and the showing proccess your function is somewhat ignored and doesn't works if called directly. That is why the timer(try w/o it and check it out by yourself).
I have also tried to set value
and index
in the creation params, but none worked(they actually should).