cancel
Showing results for 
Search instead for 
Did you mean: 

oDataModel parameters for paging - $top, $skip, $count

Former Member
0 Kudos

Hi,

I can’t find the way, how to set this parameters to oDataModel request. At the moment, when I am checking IE Developer Tool network state, it’s show URL - http://services.odata.org/Northwind/Northwind.svc/Suppliers?$skip=0&$top=29&$select=SupplierID%2c%20... with this parameters - I understand that’s from default - this request get all records from service and no one skipped, but where I can add this parameters in my code ? I tried some way at oTable.bindRows(), but didn’t worked, it seems I am doing something wrong.

Thanks,

Toms.

Accepted Solutions (1)

Accepted Solutions (1)

martingerritsen
Explorer
0 Kudos

Hi Toms,

Creating a model and bind the model to the table is enough for you to use the paging functionality. The table will automatically retrieve the next chunk of data after using the scrollbar / paginator.

The reason why you still receive 29 entry's is that the tables default number of data records to retrieve as a chunk is 100. Adding the Threshold setting to your table will fix the problem.

Since you have 15 rows visible on the screen, i should set the threshold at 16. I have seen that if you keep the VisibleRowCount equals to Threshold, that it wouldn't work because the table will not be triggered to retrieve the next chunk of data.

var table = new sap.ui.table.Table({

  visibleRowCount: 15,

  threshold: 16,

});

table.bindRows("modelName>/entityName/");

Good luck...

Answers (1)

Answers (1)

UweFetzer_se38
Active Contributor
0 Kudos

Hi Toms,

if you bind your oData model against an UI5 table, you don't have to think about pagination ($top,$skip,$count), because the table does it all for you.

If you still want to do the handling for any reasons for yourself, try

var oModel = new sap.ui.model.odata.ODataModel("http://services.odata.org/Northwind/Northwind.svc/Suppliers?$skip=0&$top=29&$select=SupplierID%2c%20......");

I haven't tested this statement, but it should work.

Best regards

Uwe

Former Member
0 Kudos

Hi Uwe,

thanks for answer, but in my table paging not working, when i look at IE Developer Tool in Network state, i can found request who gave me all records at one time, for example, oData collection contain 29 entrys, bind oDataModel to table, then open view where is table with paging (one table page contain 15 rows), and go to IE Developer Tool and found request with all 29 records. But in this place should be request with only 15 records. Maybe i am doing something wrong, i'm beginner in sapui5 development.

And maybe you know, how to get $count from service ?

Thanks a lot,

Toms.

surendra_pamidi
Contributor
0 Kudos

Hi Toms,

If you want 15 rows, set $top as 15 or if you want any conditional 15, then do some $select kind of thing. Anything you want to do, you can do by using these uri conventions.. If you want more information try to get at OData URI Conventions.. It is very useful in this type of conditions..

URI Conventions | Open Data Protocol | ODataOpen Data Protocol | OData