cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to load all data in sap.m.CombBox from oDataModel

Former Member
0 Kudos

Hi,

I am using sap.m.ComboBox in our application. And to fetch the countries name in it
use oData Model. It is fetching the data (Country Name) in the control but not all countries items.(sap.m.ComboBox shows only 100 countries).

And I try to see the data which is attached to the sap.m.CoboBox control in console

by using this code sap.ui.getCore().byId("countrolName").getModel().oData

it is also showing the 100 countries. (But in database shows 200 countires)

Please suggest something to show all the items(data) in sap.m.ComboBox.

Thanks & Regards
Somdutt Sharma

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Somdutt,

The default size limit of the model in combobox is 100.

You need to change the sizeLimit of the model explicitly before setting the model to the control.

oModel.setSizeLimit(250); // if you are directly setting odata model use the limit based on your data

oModel.setSizeLimit(oData.results.length); // if you are using json model

Answers (2)

Answers (2)

former_member221786
Active Participant

Hey Somdutt,

I just wrote an Blog article about this subject so I wanted to propose one more solution which should be a little more elegant.
If you want you can set sizeLimit per Binding. Just add parameter length to your Binding and your fine:

<ComboBox
  items="{
    path: '/Country',
    length: 250
  }" >
  <items>
    <core:Item key="{CountryIsoCode}" text="{Text}" />
  </items>
</ComboBox>

Works also in Java-Script:

var oControl= this.getView().byId("countrolName");
oControl.bindItems({
	path: "/Country",
	template: new sap.ui.core.Item({key:"{CountryIsoCode}",text:"{Text}"}),
        length: 250
});

Maybe this is something which doesn't have that much side effects than setting sizeLimit for a Model globally.

Also if you're interested see my whole article here

Greetings,
Sebastian

shatsijev
Explorer
0 Kudos

Such an easy question and you are the only one able to answer to it correctly, big thanks

0 Kudos

Hi Somdutt,

The default size limit of the model in combobox is 100.

You need to change the sizeLimit of the model explicitly before setting the model to the control.

oModel.setSizeLimit(250); // if you are directly setting odata model use the limit based on your data

oModel.setSizeLimit(oData.results.length); // if you are using json model