on 07-24-2015 10:59 AM
Hello Friends,
I have created xml view which contains inputs and input helps.
For Input helps it is fetching data from OData service.
This is code for "Code Group" Input....
<Input id="ni1" showSuggestion="true" showValueHelp="true"
placeholder="Enter QM Group ..." suggest="onSuggest"
suggestionItemSelected="onSuggestionItemSelected"
suggestionItems="{/d/results}" type="Text" valueHelpRequest="onQmGroupSelect">
<suggestionItems>
<core:Item text="{QmCodeGroup}" />
<core:Item text="{CodeGroupText}" />
</suggestionItems>
</Input>
When we click on icon yellow as highlighted in above image.....
It will fetch data via oDATA service and display it in popup as shown below...
I have created fragment.xml file for the popup...
when we type something in search it should filter those values... I am facing issue while doing that...
Code for Fragment.xml file......is as below ::::
<core:FragmentDefinition
xmlns="sap.m"
xmlns:core="sap.ui.core">
<SelectDialog id = "Dialog1"
title="Code Groups"
class="sapUiPopupWithPadding"
items="{/d/results/}"
search="_handleValueHelpSearch"
confirm="_handleValueHelpClose"
cancel="_handleValueHelpClose">
<StandardListItem id = "List1"
title="{QmCodeGroup}"
description="{CodeGroupText}"
/>
</SelectDialog>
</core:FragmentDefinition>
Please help me how i can implement filter for the same...
right now i have written below code :
_handleValueHelpSearch : function(evt) { | ||||||
debugger; | ||||||
var sValue = evt.getParameter("value"); |
if (this.inputId == "Page--ni1") { | ||||||||||||||
sap.ui.getCore().setModel(oModel2); | ||||||||||||||
var query = evt.getParameter("value"); | ||||||||||||||
var filters = []; |
if (query && query.length > 0) { | ||||||||||
var filter = new sap.ui.model.Filter("QMCodeGroup", | ||||||||||
sap.ui.model.FilterOperator.Contains, query); | ||||||||||
} | ||||||||||
debugger; |
// update list binding | |||||||
var list = evt.getSource(); | |||||||
var binding = list.getBinding("items"); | |||||||
binding.filter(filter); | |||||||
} |
Please advise i am stuck and struggling at this point from last 2 days...
Thanks in advance....
Regards,
Gaurav Wani
solved by myself
var sTerm = oEvent.getParameter("suggestValue");
this.inputId = oEvent.oSource.sId;
if (sTerm) {
if (this.inputId == "Page--ni6") {
oModel4 = new sap.ui.model.json.JSONModel();
newurl4 = "http://server:port/sap/opu/odata/sap/ZIMS_INPUT_HELP_SRV/InputHelpPrioritySet?$format=json";
oModel4.loadData(newurl4, null, false, "GET",
false, false, null);
sap.ui.getCore().setModel(oModel4);
var aFilters1 = [];
aFilters1.push(new sap.ui.model.Filter(
"Priority",
sap.ui.model.FilterOperator.StartsWith,
sTerm));
oEvent.getSource()
.getBinding("suggestionItems").filter(
aFilters1);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.