Skip to Content
0

Dynamic path for aggregation binding in XML view

Jul 27, 2017 at 02:02 PM

96

avatar image
Former Member

Hi All,

Currently i am using odatamodel to retrieve data from hanaview with input parameter through odataservice.

I am able to retrieve data successfully with the below syntax with static values.

<Table id="table0" items="{br>/ViewParameters(Year='2017',Customer='ABCD')/Results}">

so my requirement is i need to pass those parameters values dynamically based on the tile which was selected.so i need to read the content of the tile and then pass those values to the items aggregation with the above syntax in XML view.

Please let me know how to achieve this.

Thanks

Shashi

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Srikanth KV Jul 27, 2017 at 04:56 PM
0

Its possible to have dynamic path of aggregation using Javascript by creating a string of the path.

var sYear = '2017';
var sCustomer = 'ABCD';
var sBindAggregationPath = "br>/ViewParameters(Year='" + sYear + "',Customer='" + sCustomer + "')";

var oTable = this.getView().byId("table0");     //access table by id
oTable.bindAggregation("items", {
        path: sBindAggregationPath,
        template:     <this needs to be ColumnListItem defined in XML>
});

When using bind aggregation it is mandatory to provide 'template'

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Aug 05, 2017 at 02:08 PM
0

Hi srikanth,

Thanks for your inputs. I am able to get the data with binditems instead of bindaggregation.

I am trying your method as you mentioned above but i am unable to use template. How to assign columnlistitem which was defined in XML view to template..

Could you please let me know.

Thanks

shashi

Show 3 Share
10 |10000 characters needed characters left characters exceeded
var oTemplate = new sap.m.ColumnListItem({
				cells: [
					new sap.m.Text({
						text: "{Name}"
					}),
					new sap.m.Text({
						text: "{Age}"
					}),
					new sap.m.Text({
						text: "{Address}"
					}),
					new sap.m.Text({
						text: "{DOB}"
					})]
                               });
userTable.bindItems("/results",oTemplate);
// /results is the entity which has the value 
// oTemplate with mapping Name, Age,.. is part of the entity /results. 

0
Former Member
Sharath M G

Hi sharath,

The above template is for sap.m.table. How to write oTemplate for SAP.UI.table.Table?

Thanks

sheshi kanth

0

Look up the api for sap.ui.table. Use sap.ui.table instead of sap.m.table and compare the properties used in the sap.m.table.

0