cancel
Showing results for 
Search instead for 
Did you mean: 

Bind Items in table with growing property

Former Member
0 Kudos

Hi All,

I have a table which I am binding with Odata using oTable.bindItems but after Binding if I check length of items in table it shows me only the number that has been mentioned in growing. Suppose I have 10 items in the list and my growing threshold is 4 so this items.length gives me 4 but i am expecting it to be 10. how to achieve this?

Thanks & Regards,

Mansi

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Thanks for replying.

But my problem is not solved.

oTable.getItems() gives me items but

oTable.getModel().getData() is null.

How to get the complete length. Please help. I am stuck.

Thanks,

Mansi

Private_Member_15166
Active Contributor
0 Kudos

See this link.

JS Bin - Collaborative JavaScript Debugging

As suggested this will work.

santhu_gowdaz
Active Contributor
0 Kudos

try like this,

oTable.getModel("TablebindedModel").getProperty('/modelData');

In my case in table - items="{oTableData>/aTableData}"

so ,

var oTableModel = oTable.getModel("oTableData");

        if(oTableModel != undefined)

            console.log(oTableModel.getProperty('/modelData'));

//In console the table data is displayed.

Former Member
0 Kudos

Hi Santhosh,

This sounds good.

I am binding it using oTable.bindItems because I need to pass parameters with Url but I am not able to getData() after getModel(). What could be the reason??

Thanks,

Mansi

santhu_gowdaz
Active Contributor
0 Kudos

How you did oTable.bindItems()?? code?

Former Member
0 Kudos

this._oTable.bindItems({

  path: "/I_Purchaserequisition_Wd(PR='',PRID='ABCD')/to_Item",

  template: this._oItemTemplate

  });

Qualiture
Active Contributor
0 Kudos

He is using ODataModel, so not all data is already loaded in the model.

And the reason you don't see any data yet is because your data is loaded asynchronously. You cannot call getData right after you set your model.

But you can get the count from the binding, even if not everything is loaded yet:


            onAfterRendering : function() {

                var oBindings = this.getView().getModel().bindList("/Customers");

                console.log(oBindings.getLength());

            }

former_member182372
Active Contributor
0 Kudos

ODataListBinding.getLength() should return you the whole legth

santhu_gowdaz
Active Contributor
0 Kudos

items.length will gives the count of only the shown data. so use use your table model length.

at the time of binding you will get all the records.

so ,

var oModel1 = new sap.ui.model.json.JSONModel();

                    oModel1.setData(data);

                     aData = oModel1.getProperty("/d/results");

console.log(aData.length);//will gies the length of your table data.

else,

get the table model and see the length like above.

oTable.getModel().getData().length;