on 2015 Nov 16 7:11 PM
Hi,
I got a JSON model as follows
{
"items": [
{
"name": "Test1,
"description": "Description1"
},
{
"name": "Test2",
"description": "Description2"
}
]
}
Binding:
var oModel = new sap.ui.model.json.JSONModel();
oModel.loadData("./json/items.json",null,false);
Is there any way I can filter at this spot by name name=Test1
The reason is that I have form layout in which I want to only show this filtered value
Request clarification before answering.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Actually I had to loop accross to get the items and that worked with a charm. $grp was not working so i decided to loop it
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
another example that you can do binding on the fly
filter is a binding thing, not model. you can do grep once data is loaded
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this is complete code listing:
| var oModelPrDetails = new sap.ui.model.json.JSONModel(); | ||||
| oModelPrDetails.loadData("./json/PR_Workitems.json",null,false); | ||||
| var oGridLayout = new sap.ui.layout.form.ResponsiveGridLayout("PRIGridLayout"); | ||||
| var oFormLayout = new sap.ui.layout.form.Form("PRIFormLayout", { | ||||
| layout: oGridLayout | ||||
| }) | ||||
| var oFContainer = new sap.ui.layout.form.FormContainer("TaskData",{ | ||||
| title: new sap.ui.core.Title({ | ||||
| text: "Task Information", | ||||
| tooltip: "Task Info" | ||||
| }) | ||||
| }); | ||||
| var oFETask = new sap.ui.layout.form.FormElement("Tasks", { | ||||
| label: "Task Information", | ||||
| fields: new sap.m.Input({ | ||||
| type: sap.m.InputType.Text, | ||||
| value: "{name}", | ||||
| }) | ||||
| }); | ||||
| oFormLayout.setModel(oModelPrDetails); | ||||
| oFContainer.addFormElement(oFETask); | ||||
| oFormLayout.addFormContainer(oFContainer); |
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 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.