PDA

View Full Version : [CLOSED] Combobox with grouped items



alessandra.monica
Jan 10, 2017, 12:21 PM
Hi,

I would need a combobox that displays items grouped
according to a certain field.

It is something like in the attached image.

24809

The selectable items must be the ones under the groups, such as "Anzahl_Ankunftsanmeldungen"
in the example.

How can I achieve that? I have searched in the examples and in the forums
but I could not find a solution.

Thank you.

fabricio.murta
Jan 13, 2017, 3:28 AM
Hello @alessandra.monica!

This is not a feature ready out-of-the-box, but the way to go is basing your combo box on this example:
- Form fields > Combo box > Custom Drop Down List (http://examples2.ext.net/#/Form/ComboBox/Custom_Drop_Down_List/)

What should be worked then would be about these lines:
1. add the grouping field to the combobox store's model
2. sort the store first by the group column (it could be just a number to represent each group, in the desired order)
3. then 2nd sort order would be the description, maybe, so you get a list with grouped and ordered items
4. (maybe the challenge would be here) if first record or the group name/id differs from previous record, then add print the row with the group name as in your screenshot
5. format the record normally as in the example above

As it is not a feature nor something supported out-of-the box, we don't really have a ready example on how exactly to do this. But given these directions if you still can't make it work and look as you want, please share how far you gone with it (in a simplified code sample as documented in this thread (http://forums.ext.net/showthread.php?61176)), we'll do our best to assist you!

alessandra.monica
Jan 20, 2017, 1:53 PM
Thank you Fabricio,

you can close the thread!

fabricio.murta
Jan 21, 2017, 2:52 PM
Hello! Thanks for the feedback and I'm glad we (likely) were able to help you!