cancel
Showing results for 
Search instead for 
Did you mean: 

Working with Table in SAPUI5

Former Member
0 Kudos

Hi All,

I have create a simple SAPUI5 application, with a table. Each row in the table has a check box, and there is a button in the table header.

Now on click of this button in the table header, I want to loop through all the rows in the table and extract the rows, with checkbox selected. I tried using the getRows() method of the Table UI, but this method returns only the set of rows, that are displayed on the table. I mean, even if the table has 50 rows and the visible row count is set to 5, this method returns only those 5 visible rows.

Also, is there a way to bind the double click event, to each row in a table? In this event handler, i want to open a popup window.

Please help me in implementing these. Any pointers on these, would be of great help!

Thanks & Regards,

Vishweshwara P.K.M.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

test

Try the above link....and view Page Source ...I think it might be little Helpful 

konstantin_anikeev
Active Contributor
0 Kudos

Hi Vishweshwara,

please use the model, not the table...

Best Regards

Konstantin

Former Member
0 Kudos

Hi Konstantin,

Thanks for your replay.

I tried to use model as well, but the getProperty() method of the model, needs the context. I didn't get the way to pass the context of each row to this method, to be able to check all the entities present in the model. Can you please elobarate on how to use model in this case?

Thanks & Regards,

Vishweshwara P.K.M.

konstantin_anikeev
Active Contributor
0 Kudos

Hi Vishweshwara,

I'm not sure you need a context. You just need to get the array, which is bound to the table and make a loop on it. Could you please provide your model data...

Best Regards

Konstantin

Former Member
0 Kudos

Hi Konstantin,

The custom data/local data object, bound to a table through JSONModel, can be accessed by means of an array. But my question, was for ODataModel. If I bind the table to the OData fetched from a Gateway Service, then how do I do this looping. Can we get an array out of the OData model and loop through that? If yes, please let me know, how to do this.

Thanks & Regards,

Vishweshwara P.K.M.

konstantin_anikeev
Active Contributor
0 Kudos

Oh... oData. Now I got it.

I suppose it's not possible to get all value, if you request only some of them for the table. According to Dev. Guide.

The ODataModel enables binding of controls to data from OData services. The ODataModel is a server-side model, so the whole dataset is only available on the server, the client only nows the currently visible rows and fields. This also means sorting and filtering on the client is not possible, the client has to send a request to the server to accomplish these tasks.

Best Regards

Konstantin

surendra_pamidi
Contributor
0 Kudos

Hi Vishweshwara,

We can get an array from oData. Use JSONmodel to do that.

var country=new Array();

$.getJSON(odata-url,function(data) {

oModel.setData({country_data : data.d.results});

for (i = 0; i < data.d.results.length; i++) {

country[i] = oModel.oData.country_data[i].COUNTRY_NAME;

}});

So that you can get an array of countries from oData which is having path like this...

d/results/COUNTRY_NAME

Regards,

Surendra.