Skip to Content

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

Dec 08, 2017 at 03:19 AM


avatar image

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!

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Arjun Biswas Dec 09, 2017 at 03:52 AM

Hi Cong Wang,

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


Arjun Biswas

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thank you Arjun Biswas! I'll give up grouping.