Click here and follow my SAP UI5/FIORI snippets and information Page
I have done suggestion concept for input field.If you enter anything in input field then it would go for matching in the model and display the appropriate result. eg. Suppose you enter "v" then it would display "vikas","Vikrant" and "Vikral".Go through it and please let me know in case of any issue/doubt.
Application Structure
Controller Part
// write in onInit().....
var json=new sap.ui.model.json.JSONModel();
json.loadData("model/Categories.json",null,false);
var idd=this.getView().byId("suggestId");
idd.bindAggregation("suggestionItems","/categories",new sap.ui.core.Item({
text:"{Title}"
}));
idd.setModel(json);
View Part
<f:SimpleForm>
<FlexBox
alignItems="Start"
justifyContent="Center">
<items>
<Input id="suggestId" showSuggestion="true"/>
</items>
</FlexBox>
</f:SimpleForm>
Categories.json
{"categories":
[
{
"Title": "vikas",
"icon": "begin",
"category": "Sales"
},
{
"Title": "Vikrant",
"icon": "begin",
"category": "Sales"
},
{
"Title": "Vikral",
"icon": "begin",
"category": "Sales"
},
{
"Title": "RajiV",
"icon": "begin",
"category": "Sales"
},
{
"Title": "Rahul",
"icon": "begin",
"category": "Sales"
}
]
}
No comments:
Post a Comment