Skip to Content
author's profile photo Former Member
Former Member

how to apply filters on RowRepeater

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

RowRepeater - SAPUI5 Demo Kit

Any help is appreciated.

Thanks in Advanced.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Sep 30, 2014 at 10:29 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Kiran Kumar Valluru

      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.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.