Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
116
rated 0 times [  118] [ 2]  / answers: 1 / hits: 19158  / 10 Years ago, tue, november 25, 2014, 12:00:00

I have created a table in the xml view, I would like to bind the table in the controller
so it can be modified dynamically depending on who is loading the app.



XML VIEW



<Table inset=false
id=pTable>
<columns>
<Column id=year width=auto>
<Text text=Year />
</Column>
<Column id=rating width=auto>
<Text text=Performance Rating/>
</Column>
<Column id=respect width=auto>
<Text text=Managing with Respect />
</Column>
</columns>
<items>
<ColumnListItem>
<cells>
<Text id=tYear text={Begda} />
<Text id=tRating text={Rating} />
<Text id=tRespect text={MwrRating} />
</cells>
</ColumnListItem>
</items>
</Table>


JS Controller



var pHistory = this.byId(pTable);
var phURL = /PMRPerformanceSet/?$filter=IvGuid eq '5438A43913276540E1008000A7E414BA'
pHistory.setModel(oModel);
pHistory.bindRows(phURL);


It seems like the controller should look something like this, however, this does not work



Any suggestions?


More From » odata

 Answers
97

I guess you are using sap.m.Table:



<Table id=pTable 
inset=false
items={/PMRPerformanceSet}> // add items Here for your oData collection
<columns>
<Column id=year width=auto>
<Text text=Year />
</Column>
<Column id=rating width=auto>
<Text text=Performance Rating/>
</Column>
<Column id=respect width=auto>
<Text text=Managing with Respect />
</Column>
</columns>
<items>
<ColumnListItem>
<cells>
<Text id=tYear text={Begda} />
<Text id=tRating text={Rating} />
<Text id=tRespect text={MwrRating} />
</cells>
</ColumnListItem>
</items>
</Table>


Then set Model in controller.
check your odata service response in Network tab of developers tool then Bind items according to that
in XML view.


[#68703] Sunday, November 23, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
blaynetheoi

Total Points: 146
Total Questions: 116
Total Answers: 103

Location: India
Member since Thu, Apr 8, 2021
3 Years ago
;