Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Adding a new Item in Select Box

Dear Experts ,

I implemented a select box (dropdown) by reading data from a northwind ODATA service and able to see the items in my dropdown.

Now I want to add an extra item "ALL" at the beginning . Can any body help me how can i do that .

Here is the code that i used to do this

View Code:

<Select id="idselect" items="{OdataModel>/Employees}"  change="somemthod">

  <core:Item  text="{OdataModel>FirstName}" key="{OdataModel>FirstName}"/>

  

  </Select>

Controller Code:

onInit: function()

{

  var oDataModel = new sap.ui.model.odata.ODataModel("proxy/http/services.odata.org/Northwind/Northwind.svc");

         sap.ui.getCore().setModel(oDataModel,"OdataModel");

}

Kindly help with the code to create a new Item "ALL" in the Dropdown.

Thanks

Rizwan

replied

Well, please check source here -> https://jsbin.com/sajoju/edit?html,output

Two "fast (and dirty)" options how to add required item to Select object

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question