cancel
Showing results for 
Search instead for 
Did you mean: 

retrieve the column names of an Entity from the metadata of xsodata

Raghu9t2
Participant
0 Kudos

Hi ,

     how to get the list of column names of a particular entity from the metadata of an xsodata call. can anyone provide me solution for this and the way to approach for this method??



Regards

Raghu M

Accepted Solutions (0)

Answers (1)

Answers (1)

pfefferf
Active Contributor

Hello Raghu,

you can use method getServiceMetadata of the ODataModel (OpenUI5 SDK - Demo Kit).

In the returned object you can access the entity types array by dataServices.schema[0].entityType. For each entity type array a property array exists which contains the names of the properties (="columns").

Here an example using the northwind service.

Best Regards,

Florian

Former Member
0 Kudos

Hi,

Try this.

  var oTable = detailView.getView().byId('idItemTable');

  var dataToExport = detailView.getView().getModel().getData();

  var colNames = [];

  var colDetails = [];

  oTable.getItems()[0].mAggregations.cells.map(function(item,index){

       colDetails.push(item.mBindingInfos);

  });

  oTable.getColumns(true).map(function(item,index){

  colNames.push(item.getHeader().getText());

  });