Announcement

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

    TreeGrid filtering on client

    Hi,

    I would like to achieve to load from server a datasource bound tree grid with rows (parent/child relation) based on a simple criteria composed of 3 field/values and then allow the user to filter the rows on client based on other fields. Is is possible?

    I tried the following setup but it didn't work. Here is the code:
    Code:
    public class CustomTreeGrid extends TreeGrid {
    public CustomTreeGrid() {
    
    	setDataSource(dataSource);
    	setAutoFetchData(false);
    	setShowFilterEditor(true);
    	setLoadDataOnDemand(false);
    
    	setKeepParentsOnFilter(true);
    	setServerFilterFields("f1","f2","f3");        
    
    	setFields(f1,f2,f3,f4,f5,f6);//f1-6 are TreeGridField objects
    }
    
    public void fetchCustom(String v1,String v2,String v3) {
            Criteria criteria = new Criteria("f1",v1);
            criteria.addCriteria("f2", v2); 
            criteria.addCriteria("f3", v3);
            fetchData(criteria);
    }
    }
    When used this version the fetchCustom sends to server no fields in the criteria, altough ServerFilterFields is set with those 3 fields.
    If setKeepParentsOnFilter and setServerFilterFields lines are commented out then fetchCustom sends the right criteria to server, but using the Filter Editor triggers a new server call with additional field/value.

    I also tried to use on the tree grid:
    Code:
    ResultTree dataPropeties = new ResultTree();
    dataPropeties.setKeepParentsOnFilter(true);
    dataPropeties.setServerFilterFields("f1","f2","f3");
    setDataProperties(dataPropeties);
    but didn't work either.

    Could you please advise what is wrong with that code?
    I used the latest smartgwtpower-3.1p-2013-03-05.

    Thanks,
    Mihnea

    #2
    There's nothing obviously wrong with this code and it matches automated tests that are passing. Lots of things could be happening:

    1. criteria on serverFilterFields as produced by filterEditor not identical to criteria initially applied

    2. missing / bad DataSourceField declarations for some fields

    We'd need more information to help further, or ideally, runnable code where we can see the problem.

    Comment


      #3
      Hi. Could you maybe provide a showcase for treegrid with client-side filtering ?

      Comment


        #4
        We may add one in a future version.

        Comment

        Working...
        X