Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 845

Conditional Data Binding with XML Model for sap.m.Select

$
0
0

Hello All,

 

I have three Drop downs.

Drop down 1 contains list of countries

Dropdown 2 contains list of cities

Dropdown 3 contains List of the famous places in the City.

 

Now i need to create the xml Model for the above requirement.

 

 

<?xml version="1.0"?>

<select>

<Country></Country>

<Country>Afghanistan</Country>

<Country>Bahrain</Country>

<Country>Canada</Country>

<Country>Denmark</Country>

<Country>Egypt</Country>

<Country>France</Country>

<Country>Germany</Country>

<Country>Hong Kong</Country>

<Country>India</Country>

<Country>Japan</Country>

<Country>Korea</Country>

<Country>Libya</Country>

<Country>Malaysia</Country>

<Country>New Zealand</Country>

<Country>Oman</Country>

<Country>Pakistan</Country>

<Country>Qatar</Country>

<Country>Romania</Country>

<Country>Saudi Arabia</Country>

<Country>Turkey</Country>

<Country>United Arab Emirates</Country>

<Country>Vietnam</Country>

<Country>Yemen</Country>

<Country>Zambia</Country>

</select>

 

 

 

 

 

 

 

 

  var oModelXML = new sap.ui.model.xml.XMLModel(); 

     oModelXML.loadData("model/data.xml",null,false);

     var mTable = new sap.m.Table();

     mTable.addColumn(new sap.m.Column({header : new sap.m.Label({text : "Product Name"})}));

     var colItems = new sap.m.ColumnListItem({type : "Active"});

    // mTable.bindAggregation("items","/value",colItems);

     var productName = new sap.m.Text({text : "{heading}"});

     colItems.addCell(productName);

     mTable.setModel(oModelXML);  

     mTable.bindItems("/",colItems);

     var selectTemplate = new sap.ui.core.Item({text : "{text()}"})

     var countryDropDown = new sap.m.Select("countryDropDown",{

      items :{

      path : "/Country",

      template : selectTemplate

      }

     });

     var cityDropDown = new sap.m.Select("cityDropDown",{

      items :{

      path : "/Country",

      template : selectTemplate

      }

     });

     var localAreaDropDown = new sap.m.Select("localAreaDropDown",{

      items :{

      path : "/Country",

      template : selectTemplate

      }

     });

     var selectModel = new sap.ui.model.xml.XMLModel();

     selectModel.loadData("model/select.xml");

     countryDropDown.setModel(selectModel);

     cityDropDown.setModel(selectModel);

     localAreaDropDown.setModel(selectModel)

 

Could anybody please help me to create the xml file for the above mentioned requirement.

Your help will be appreciated.

 

Thanks in Advance.

 

 

Regards,
Shekar


Viewing all articles
Browse latest Browse all 845

Trending Articles



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