Skip to Content

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

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Sep 15, 2016 at 03:19 AM

    Hi Shekar,

    Will this sample help? Plunker

    Regards,

    Sai.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.