Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 10022

Creating table with SAPUI5 from JSON

$
0
0

Dear all,

 

I have created a JSONModel from the data shown below.

 

<ns2:Project xmlns:ns2="project:model">     <Id>6</Id>     <Code>AB12213</Code>     <Version>0</Version>     <Name>XXXXX</Name>     <IsRegionalProject>false</IsRegionalProject>     <CreatedDate>2013-04-29T00:00:00</CreatedDate>     <Status>ACTIVE</Status>     <Locations>          <ns2:Location>               <Id>1</Id>               <IsMain>false</IsMain>               <GeoLocations>                    <ns2:GeoLocation>                         <Id>0</Id>                         <Longitude>XX.XXX</Longitude>                         <Latitude>XX.XXX</Latitude>                    </ns2:GeoLocation>               </GeoLocations>          </ns2:Location>          <ns2:Location>               <Id>2</Id>               <IsMain>false</IsMain>               <GeoLocations>                    <ns2:GeoLocation>                         <Id>0</Id>                         <Longitude>XX.XXX</Longitude>                         <Latitude>XX.XXX</Latitude>                    </ns2:GeoLocation>               </GeoLocations>          </ns2:Location>     </Locations></ns2:Project>

 

 

Now I set the model

 

sap.ui.getCore().setModel(oModel,"mainModel");

 

(oModel has the data loaded)

 

In the table, I bind the rows as below

 

locTable.bindRows('mainModel>/Locations');

 

Now in the above table(locTable), I need the rows to display the data in 3 columns : 'IsMain', 'Longitude' and 'Latitude'.

 

I am able to display the value of  'IsMain', like this : mainModel>IsMain.  But how do I display the Longitude and Latitude and these values lie inside the 'GeoLocations' tag.

 

Regards,

Noufal


Viewing all articles
Browse latest Browse all 10022

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>