Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How apply different criteria for grid filter and server fetch?

    5.1-p20161009

    Hi, I might be old, but I couldn't find an answer to this.

    Basically, I want to be able to define a criteria for filtering, say "name equals banana", but send another criteria to be used server-side, for example "date before 2016". I can't get this to work. Code:

    Code:
    Criterion gridFilter = new Criterion("name", OperatorId.EQUALS, "Banana");
    grid.setCriteria(gridFilter);        
    
    Criterion serverFilter = new Criterion("enabled", OperatorId.EQUALS, true);
    grid.fetchData(serverFilter, null, getDSRequestReqProps());
    If I only apply the "gridFilter", the grid is updated and filtered, but as soon as I do fetch data, my grid criteria seems to be removed.

    Any pointers? Can this be done?

    Cheers
    Last edited by mathias; 14 Oct 2016, 06:08. Reason: include version

    #2
    If what you mean is that the criteria used by the server should *in addition to* criteria applied by the client, you can do this in several ways. Two examples are:

    1. adding criteria in a DMI on the server
    2. modifying the criteria in dataSource.transformRequest()

    Comment


      #3
      Not quite. I would like the 'serverFilter' criteria to be passed on to the server, which I mange to do by calling grid.fetchData() with my criteria. I can then use that criteria server side with dsrequest.getcriteria, and I do that to get data to return to the client grid.

      I then get data back to the client grid. I want the filtering in the grid to be done based on *another* criteria (the 'gridFilter') above. Basically, I want to use one criteria to send to the server, and different criteria to use to filter the data in the client list grid.

      Comment


        #4
        Yes, that is the question we answered. Please take another read.

        Comment

        Working...
        X