Announcement

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

    cannot sort local ds on partial matches in fetch()

    The problem is that as the user types in search strings I need a progressive results returned so that partial string matches will sort the local ds. The problem is that treeGrid is blank after each fetch is called until the user types in an exact match to an existing record for the field selected. How can I get partial matches returned from the fetch?

    1. SmartClient Version: SNAPSHOT_v8.3d_2012-06-07/Pro Deployment (built 2012-06-07)

    2. FireFox 13.0.1

    3. Sample Code:
    final TreeGrid customerTreeGrid = new TreeGrid();
    customerTreeGrid.setDataFetchMode(FetchMode.LOCAL);
    customerTreeGrid.setKeepParentsOnFilter(true);
    customerTreeGrid.setDataSource(ds);
    customerTreeGrid.setWidth(800);
    customerTreeGrid.setHeight(250);
    customerTreeGrid.setFields(nameField,typeField, expirationDateField, locationDateField, statusField, sortPriority);




    TreeGridField nameField = new TreeGridField("NAME", "Customer");
    nameField.setWidth("*");
    TreeGridField typeField = new TreeGridField("TYPE", "Type", 100);
    TreeGridField expirationDateField = new TreeGridField("EXPIRATIONDATE", "Expiration Date", 100);
    TreeGridField locationDateField = new TreeGridField("LOCATION", "Location", 130);
    TreeGridField statusField = new TreeGridField("STATUS", "Status", 200);
    TreeGridField sortPriority = new TreeGridField("SORTPRIORITY", "",0);


    final DataSource ds = new DataSource();
    ds.setClientOnly(true);

    TreeNode[] treeNodes = new TreeNode[customers.size()];
    int i = 0;
    for(Customer customer : customers){
    TreeNode treeNode = new TreeNode();
    treeNode.setAttribute("id", customer.getId());
    if(null != customer.getParentId())
    treeNode.setAttribute("parentId", customer.getParentId());
    treeNode.setIsFolder(customer.getIsFolder());
    treeNode.setAttribute("PKID",customer.getPkid());
    treeNode.setAttribute("NAME", customer.getName());
    treeNode.setAttribute("TYPE", customer.getType());
    treeNode.setAttribute("EXPIRATIONDATE", customer.getExpirationDate());
    treeNode.setAttribute("LOCATION", customer.getLocation());
    treeNode.setAttribute("STATUS", customer.getStatus());

    treeNodes[i] = treeNode;
    ds.addData(treeNode);
    i++;
    }

    treeGrid.fetchData();

    Criteria searchCriteria = new Criteria();
    searchCriteria.addCriteria("FIELDNAME", "selectedSearchString");

    treeGrid.fetch(searchCriteria);

    /-------------- ADDING THESE CHANGES MADE NO DIFFERENCE IN BEHAVIOR -----------------/

    treegrid.setDataFetchMode(FetchMode.LOCAL);
    treegrid.setAutoFetchTextMatchStyle(TextMatchStyle.STARTS_WITH);
    treegrid.setAutoFetchData(true);
    Last edited by Mitch B; 11 Aug 2012, 08:06. Reason: Additional changes also failed

    #2
    There's no such thing as TreeGrid.fetch() - please don't represent pseudocode as real code on the forums. In this case the code that's been show as pseudocode is quite possibly the problem.

    Comment


      #3
      mistake in psuedo code

      You are correct - treeGrid.fetch() was a mistake in the psuedo code. That line should have referred to the treegrid in:
      line 1#: final TreeGrid customerTreeGrid = new TreeGrid();

      it should have been written as: customerTreeGrid.fetch(searchCriteria)

      Also, at what point does 'Sample code:' = representing psuedo code as actual code? It doesn't. Looking at any number of postings in the forums there is sample code everywhere.

      Comment


        #4
        Sample code is great. The problem is, that's not sample code.

        There's no method treeGrid.fetch() - so this code doesn't compile.

        We can't identify real problems in fake code :)

        Comment


          #5
          Possible solution but where is the getFilteredTree() method?

          Rather than continue discussing my typo, or psudo codecan you please help me with this?

          Your API describes a method that would work perfectly based on the description in the API - TreeGrid.getFilteredTree():

          I am using this documentation:
          http://www.smartclient.com/smartgwtee/javadoc/com/smartgwt/client/widgets/tree/Tree.html#getFilteredTree%28com.smartgwt.client.data.Criteria%29

          Is this outdated? I am not seeing the method in the Tree class anymore and IntelliJ is certainly not picking it up out of the SmartGWT jar.

          Comment


            #6
            We're trying to help! Please show the actual code and we can probably figure out what's wrong with it. Right now you've got a call to fetchData() and a second call to a mystery method fetch(), we have no way of knowing what's going on.

            As far as getFilteredTree(), you shouldn't need to call it (it's called automatically on your behalf) and you aren't finding it because it's a method on Tree and you are looking at TreeGrid.

            Comment


              #7
              Working on getting exact code

              Our product is security so I really have to get clearance before posting any working code. I am working on that right now.

              Comment


                #8
                We don't need the whole code of the product, or even part of it - your test case was ready to run except for the mystery method fetch(). If you can reproduce a problem with filtering in code we can actually run, that's all we need in order to point out an issue in the code, or investigate whether there's a framework issue.

                Comment


                  #9
                  Client side filter

                  How to implement the client side filter in tree grid with SetData.

                  Comment

                  Working...
                  X