Technical Articles
sap.m.ComboBox and Table Shows only 100 items
Hello Everyone
While developing the application using ComboBox we all have seen that default items shows only up to 100 records.
Control like Table and List support Paging and directly ask the list binding for the needed data for example when scrolling down. Other controls might not support this. In this case the size limit of the model is used.
We can change the size limit of Model to needed range.
var that = this;
var newArray = new Array();
var oModel = new sap.ui.model.json.JSONModel();
this.getData(function (data){
each(data.Countries,function(index, countrie){
var newData = merge({
"flag":"png100px/" + countrie.CountryCode.toLowerCase() + ".png"
},countrie);
newArray.push(newData);
});
oModel.setSizeLimit(300);
oModel.setData(newArray);
that.getView().setModel(oModel, "covid");
debugger;
});
View
<Table id="CovidTableid" items="{covid>/}" visible="false">
Now Table can show up to 300 as the Model size limit is set to 300.
But wile working with ComboBox we can also add the Limit by setting length in items.
<ComboBox id="TaxCodeCID" change="handelTaxCode" items="{path : '/ZTAXCODESet', length : '500'}">
<core:ListItem id="TaxCodeListID" key="{WITHT}" text="{DROP_DOWN}"/>
</ComboBox>
items=”{path : ‘/Your path’, length : ‘500’}
Now you can see the Records up to 500 by increasing the size limit of your model or defining the length can work.
You can refer the https://sapui5.hana.ondemand.com/ for particular properties of a control in API.
Hope this will help you all.
Thanks 🙂
do 3 combobox like that and your page will start hang. SAPUI5 is lacking of virtual scrolling on many controls. Only Treeview and UiTable has these features (but very primitive and lack of smoothness). You have same issues with sap.m.table as well, it will kill the performance due to huge number of dom elements, script and styling :/