Hi Jayasree.
In my point of view, the easier way to handle this is to create a model from the original Model like this
var stateModel = new sap.ui.model.json.JSONModel();
// attached request complete to the oData model and construct a new model
oData.attachRequestCompleted(function() {
var data = this.getData()['d']['results'];
var states = $.map(data, function(v, i) {
return {name: v.state}; // assuming state is the attribute
});
stateModel.setData(states);
});
dropDownBox.bindItems('stateModel>/', new sap.ui.core.ListItem({
key: 'stateModel>name',
text: 'stateModel>name',
}));
dropDownBox.setModel(stateModel, 'stateModel');
-D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jayasree,
Please write a logic in your method or RFC to delete duplicate entries from your return table.
Regards,
KK
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jayasree,
Please correct me if i hv misunderstood the requirement.
You have a filter called state. Upon selection state in filter, U want the below dropdown should get reflected with values (distinct values) of state. Right?
If Yes, then writing DELETE ADJACENT DUPLICATE statement can be used to remove duplicate values from your table which returns the list of states.
so your /d/results will always have unique values and you will see unique values in your dropdown also.
Another way is, Take JSON model and get state data into it using .loadData() method.
After getting data into your JSON Model use the method .getData() to get the array.
Remove duplicates from your array and set it as datasource to your dropdown.
Hope it will help a bit.
Regards,
KK
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.