cancel
Showing results for 
Search instead for 
Did you mean: 

dynamic binding of columns in a table

former_member602908
Discoverer
0 Kudos

without specifying column names in view how to get all the columns in a table using odata service

boghyon
Product and Topic Expert
Product and Topic Expert
0 Kudos

Which table are we talking about? m.Table or ui.table.Table? And what is the OData version? V2 or V4?

former_member602908
Discoverer
0 Kudos

table is sap. ui.table.Table and odataversion is v2

Accepted Solutions (0)

Answers (1)

Answers (1)

boghyon
Product and Topic Expert
Product and Topic Expert
0 Kudos

You can create columns dynamically with the help of ODataMetaModel. Take a look at this sample from the Demo Kit: https://ui5.sap.com/#/entity/sap.ui.table.Table/sample/sap.ui.table.sample.OData2/code

columns="{
  path: 'meta>/dataServices/schema/[${namespace}===\'MYSAMPLE\']/entityType/[${name}===\'Product\']/property',
  factory: '.columnFactory'
}"

In the factory function, the application should then return an instance of Column according to the controller code in the sample.

For more information about how to leverage ODataMetaModel, see the section Meta Model for OData V2.