cancel
Showing results for 
Search instead for 
Did you mean: 

[UI5] Is there group function in the items of a sap.m.Select?

former_member197944
Active Participant
0 Kudos

Hi experts, I have Select countrol for product. And bind a list of products to the items property. I want to have the feature that, when user open the select dropdown list all products are grouped into two categories (available and unavailable), and sorted by the name. So I have the folloing code:

this.byId('productSelect').getBindingInfo('items').sorter = new sap.ui.model.Sorter("", null, function(oContext) {
	            return oContext.getProperty("available") ? 
	                {key: 'available', text: 'Available'} :
	                {key: 'unavailable', text: 'Unavailable'}
			}, function(a, b) {
                if (!a.available && b.available) {
                    return 1;
                } else if (a.available && !b.available) {
                    return -1;
                }
                return a.productName.toLowerCase().localeCompare(b.productName.toLowerCase());
            });

The sorting function worked and the products are sorted like I expected. But there's no group headers like sap.m.List in DemoKit. So I want to know does items in sap.m.Select support grouping? Thank you so much!

Accepted Solutions (1)

Accepted Solutions (1)

former_member484715
Contributor
0 Kudos

Hi Cong Wang,

According to standard FIORI Guidelines, you should not use grouping within your sap.m.select. But, you can use custom filters and grouping in your case.

Regards,

Arjun Biswas

former_member197944
Active Participant
0 Kudos

Thank you arjun_9! I'll give up grouping.

Answers (0)