In my Autocomplete I need to show grouped items, but groups have to be sorted non-alphabetically.
As the Autocomplete doesn't have such option, I tried using the serverGrouping option, but I guess I'm doing something wrong.
In fact the list of groups and items is correctly displayed (see attached picture #1), but typing any character in the input shows the NO DATA FOUND message (see attached picture #2 - typing "c" should show "Coffee" and "Cake"). Additionally items sorting doesn't seem to work.
This is the Autocomplete and its DataSource initialization code:
var
dataSource =
new
kendo.data.DataSource({
transport: {
read: {
url:
"xxxxxxxxxxxxxxxxxxxxxx"
,
dataType:
"json"
}
},
schema: {
groups:
'groups'
,
},
serverGrouping:
true
,
group: {
field:
"category"
,
},
sort: { field:
"name"
, dir:
"asc"
}
});
$(
"#destinationIn"
).kendoAutoComplete({
dataTextField:
"name"
,
height: 400,
placeholder:
"Ovunque"
,
dataSource: dataSource,
});
This is the json data returned by the server call:
{
"groups"
:[
{
"field"
:
"category"
,
"value"
:
"Beverages"
,
"items"
:[
{
"name"
:
"Lemonade"
},
{
"name"
:
"Tea"
},
{
"name"
:
"Coffee"
}
]
},
{
"field"
:
"category"
,
"value"
:
"Seafood"
,
"items"
:[
{
"name"
:
"Salmon"
},
{
"name"
:
"Mackerel"
}
]
},
{
"field"
:
"category"
,
"value"
:
"Desserts"
,
"items"
:[
{
"name"
:
"Ice cream"
},
{
"name"
:
"Cake"
}
]
}
]
}
Why the Autocomplete doesn't seem to work? Am I missing something in the Autocomplete settings, or DataSource settings, or JSON being sent by the server?
And why the sorting of items doesn't work?