I have many combo boxes in my form and i want to load the values of all the comboboxes in onInit function of my controller.
For Now, I have following queries kindly guide me as i am totally new one in this technology.
1. How to refer any view object in the controller or do need to refer it to fill data in any specific control of view or it can be done within the view?
2. How to papulate data in combobox using oDataModel and how to react and refetch data on the basis of selected combobox value from a web service?
3. Is there any way to use Function Keys and Enter Key with in the form?
4. Is there any way to transfer control on Enter Key to any specific Field?
Regards
M.S. Arain
Hi,
what i did was build a generic webservice that supports key and value pairs based on a type. So you can use the same service for multiple f4 helps. Which then has a db table in the backend where you fill in the values. You can also just do one service per combobox if you want to.
So basically the service returns multiple entities with a key and a value. what you do then is to bind your control s items against that service.
Something like this:
<Select id="VehSearchStateInput" items="{ path: '/GenericKeyValueSet'
}" width="100%">
<core:Item id="VehSearchStateInputItems" key="{KeyV}" text="{Value}" />
<layoutData>
<l:GridData span="L9 M9 S12" />
</layoutData>
</Select>
Then in your controller you can define a filter if need be that is called when the control is loaded:
var oVehState = sap.ui.getCore().byId('VehSearchStateInput');
var vState = "STATE";
var oFilter1 = new sap.ui.model.Filter("Type", sap.ui.model.FilterOperator.EQ, vState);
oVehState.mBindingInfos.items.binding.filter(oFilter1);
Then when you add the attribute change : with a function handler to your select control you can define a event that is executed when something is selected.
You can get which item is currently selected via
var vState = sap.ui.getCore().byId('VehSearchStateInput').getSelectedKey();
which you then can put somewhere in your model.
hope this helps a bit.
cheers
Kay
Add a comment