1 Reply Latest reply on Jun 4, 2011 11:23 AM by dinko_ivanov

    how to filter only datagrid, not the dataprovider

    dinko_ivanov

      Hello,

       

      To filter a datagrid, I'm using the filterfunction field on my dataprovider. The problem is that this dataprovider is a collection, which is used by other views as well. I would not expect them to be filtered as well.

       

      Is there a way to filter only the View (DataGrid) and not the Model itself (ArrayCollection)?

      What would you recommend in this case?

       

      Thanks in advance!

      Regards,

      Dinko

        • 1. Re: how to filter only datagrid, not the dataprovider
          dinko_ivanov Level 1

          I made it :-)

          I revealed the magic.

           

          Actually without knowing it, I was misusing the ArrayCollection class and treating it as Model, while it was obviously designed for View purposes.

           

          Now I'm using ArrayList for that, and then I create a new ArrayCollection for different views. Then I use newArrayCollection.list = myList and newArrayCollection.filterFunction = ...

           

          This works for me.

           

          My recomendation would be to improve the documentation a bit, so that it is clear that it is not recommended to use same ArrayCollection for multiple views.

           

          Regards,

          Dinko