on 09-30-2014 10:15 AM
Hi All,
I am having following json data
var dataObject = [{name:"test1", id:"1", isSelected: true},
{name:"test2", id:"2", isSelected: true},
{name:"test3", id:"3", isSelected: true},
{name:"test4", id:"4", isSelected: false},
{name:"test5", id:"5", isSelected: false},
{name:"test6", id:"6", isSelected: true},
{name:"test7", id:"7", isSelected: true}
]
i am binding above JSON using RowRepeater control. Now there are two rowRepeater control one binds value with isSelected = true and other bind value with is selected = false; I am able to bind data to repeater grid. but filter is not working.
I have tried as
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData({"data": dataObject});
sap.ui.getCore().setModel(oModel);
var testFilter = new sap.ui.model.Filter("isSelected","EQ","true");
/*new sap.ui.model.Filter("isSelected","EQ",true);*/
oRowRepeater1.applyFilter(testFilter);
but it is not working. Also I want user can select/unselect any Name form JSON base on that both repeater should updated their data binding. Actual JSON is very huge data(columns/properties) but here I have enter only required one to understand my logic.
I have also tried following link solution but filter never come to work
Any help is appreciated.
Thanks in Advanced.
Hi,
Try this,
oRowRepeater.bindRows(
{path: "/data",
template: oRowTemplate,
filters: [new sap.ui.model.Filter("isSelected", sap.ui.model.FilterOperator.EQ, true) ]
} );
hope this helps you,
Regards,
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
For showing the count, loop over the model data and get the count.
Try this code:
var modelData = oModel.getData();
var rowCount = 0;
for(var i = 0; i < modelData.data.length; i++){
if(modelData.data[i].isSelected){
rowCount = rowCount + 1;
}
}
Now rowCount contains the count.
hope this helps,
Regards,
Kiran
Thanks Kiran,
I know this way. But there are few more filter on LHS rowRepeator control. So it will be better rowrepeater would give statistic like no of pages that he is displaying, PageSize(getRow() - give me all row, getNumberOfRow() give me current page row) + last page rowcount etc. so that I can sum them up and get exact count.
or otherwise I have to apply few more filter logic in your for loop to get that number again.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.