cancel
Showing results for 
Search instead for 
Did you mean: 

MultiInput with Odata

rubens12
Participant
0 Kudos
How can I consume a service Odata in the aItems?

bellow is my controller

sap.ui.controller("sap.ui.comp.sample.valuehelpdialog.example1.ValueHelpDialog", { onInit: function() { this.theTokenInput = this.getView().byId("multiInput"); this.theTokenInput1 = this.getView().byId("loginPara"); this.aKeys = ["user", "name"]; this.aItems = [{ user: "carlos", name: "Carlos Cesar" }, { user: "mario", name: "Sergio Mario" }]; }, onValueHelpRequest: function() { var that = this; var oValueHelpDialog = new sap.ui.comp.valuehelpdialog.ValueHelpDialog({ basicSearchText: this.theTokenInput.getValue(), title: "Login", supportMultiselect: false, supportRanges: false, supportRangesOnly: false, key: this.aKeys[0], descriptionKey: this.aKeys[1], stretch: sap.ui.Device.system.phone, ok: function(oControlEvent) { that.aTokens = oControlEvent.getParameter("tokens"); that.theTokenInput.setTokens(that.aTokens); oValueHelpDialog.close(); }, cancel: function(oControlEvent) { oValueHelpDialog.close(); }, afterClose: function() { oValueHelpDialog.destroy(); } }); var oColModel = new sap.ui.model.json.JSONModel(); oColModel.setData({ cols: [{ label: "Login", template: "user" }, { label: "Nome", template: "name" }] }); oValueHelpDialog.getTable().setModel(oColModel, "columns"); var oRowsModel = new sap.ui.model.json.JSONModel(); oRowsModel.setData(this.aItems); oValueHelpDialog.getTable().setModel(oRowsModel); if (oValueHelpDialog.getTable().bindRows) { oValueHelpDialog.getTable().bindRows("/"); } var oFilterBar = new sap.ui.comp.filterbar.FilterBar({ advancedMode: true, filterBarExpanded: false, showGoOnFB: sap.ui.Device.system.phone }); var oSearch = new sap.m.SearchField({ search: function(oEvent) { var sQuery = oEvent.getParameter("query"); var oBinding = oValueHelpDialog.getTable().getBinding("rows"); if (sQuery) { var oFilter1 = [new sap.ui.model.Filter("user", "Contains", sQuery), new sap.ui.model.Filter("name", "Contains", sQuery)]; var allFilters = new sap.ui.model.Filter(oFilter1, false); oBinding.filter(allFilters); } else { var oFilter = new sap.ui.model.Filter("user", sap.ui.model.FilterOperator.Contains, sQuery); oBinding.filter(oFilter); } } }); oFilterBar.setBasicSearch(oSearch); oValueHelpDialog.setFilterBar(oFilterBar); oValueHelpDialog.open(); } });

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member365727
Active Contributor

Create oData Model, then replace your JSON model with oData model and perform necessary binding

rubens12
Participant
0 Kudos

I don't know how can I do it.

I have to consume a OData service like this

Can you show me a example? or Help me to do it?