I have to use the grouping option, but only after initialization of the dropdownlist like this:
It work, except for the first group, which is not shown.
I reproduced my issue in http://dojo.telerik.com/oMEQU.
Also, is it possible to sort groups other than alphabetically. For example, by field "sortField" to get "Vegetables" first, then "Fruits", then "Meat" ?
7 Answers, 1 is accepted
The group header will be shown only if the whole data source is updated. You will need to use the setDataSource method for that task:
Check the updated demo: http://dojo.telerik.com/@ggkrustev/iXUXi
The group functionality of the DataSource component allows to sort ascending or descending the grouped source. You can find more details in the corresponding documentation: serverGrouping to true.
Because of the structure of my project, I really can not perform grouping on the server. I thought about using a GroupTemplate to change the text of the groups, but I end up with the original problem of the header not replaced.
Example is here: http://dojo.telerik.com/EkUvE
I would suggest you update fixedGroupHeader too. Checked the updated demo:
Let me know if I am missing something in the described scenario.
Thank you for that information, using fixedGroupTemplate solves a part of the problem.
But now, why are these 2 templates looks different?
The first group renders a <div> outside the ul-li zone, so, it uses the whole line, and the first "option" is under it. And, it's not the same color!
For all others, the optiongroup is merged on the same line, and is rendered as a <div> inside the first <li> of each group.
It's strange that the first group doesn't have the same presentation as the other ones.
We'll be able to fix it by adjusting the padding and other CSS of both presentations to makes them look the same.
But we don't understand why you did that, as they should be rendered the same way, first group or not!
I was able to "fix" your combo to make it run as expected, with that fix: (in settimeout section). I really think that it's a bug that should be fixed. Or, maybe there is another reason why you make the first group display differently?
Your observations are correct. Basically, the widget has two group templates (as we already know) - one for the item (groupTemplate) and one fixed that shows the active group on scroll. To avoid to display two group titles at the beginning, the very first groupTemplate item (the one in the first LI element) is not rendered. You can observe the need of fixedGroupTemplate in our online demo.
What we can do is to enhance current behavior and allow to disable the fixedGroupHeader. Thus there will be no need to insert a group element manually. We will further investigate this functionality.
For now if you would like to disable the fixedGroupHeader, then you will need to use the mentioned approach.