I'm giving custom templates option in kendo select drop down where I need to sort the values ie., here names in ascending or descending order.
Here is my code in customOptions
$scope.customOptions = {
placeholder: "Select employee...",
valuePrimitive: true,
autoBind: false,
itemTemplate: '<span class="k-state-default">' +
'<img src="#:data.imagePath#" alt="edit" width="24px" height= "24px" /></span>' +
'</span> ' +
'<span class="k-state-default" >#: data.name #</span>',
tagTemplate: '<span class="selected-value">' +
'<img src="#:data.imagePath#" alt="edit" width="24px" height= "24px" /></span>' +
'</span>' +
'<span>#:data.name#</span>'
}
I tried to give k-sort='asc' in my select dropdown but it didn't worked out..
<select class="employeeMultiSelect " kendo-multi-select k-ng-model="selectedEmployees" k-data-text-field="'name'"
k-data-value-field="'id'" k-data-source="employeeList" k-options="customOptions" k-sort='asc'
k-rebind="customOptions"></select>