Announcement

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

    Wildcard filtering in ListGrid

    Hi,

    I'm using smartGWT version 2.5 and need to have implemented various styles of filtering in ListGrid, one of that style should be database like wildcard filtering using % that means when I have following data
    Test 1, Test 2
    and put T%1, Test 1 should be returned.

    I see that there it's possible to setup various filter operator using ListGrid.setFilterOperator but none of that is fitting this requirement, similar is regexp but I don't want to support all regexp.

    I found out also applyFilter method in ResultSet javadoc http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/data/ResultSet.html, but this method is not accsesible in Java API.

    only one solution I found is that I'll transform criteria when user type %, I'll create Regexp expression and % will be replaces to .* but it doesn't seem to as a good solutions, what do you propose to me to solve it?

    thanks,

    michal

    #2
    For now the solution you have seems like it should work fine.

    We have a designated method in the framework for creating criteria based on form item values that would handle this more neatly (see formItem.getCriterion) but this is currently not available as an override point in SmartGWT.

    This really should be part of the core framework, so we'll be adding this feature to SmartGWT soon.
    We'll update this thread to let you know when the feature is available in nightly builds (though it will be part of the mainline feature development branch rather than appearing in 2.5).
    If for some reason your existing approach isn't going to work for you and you need further assistance on this, let us know.

    Comment


      #3
      Any update on "sql like wildcard filtering client side" ?
      MichalG

      Comment


        #4
        This has been implemented - see listGrid. allowFilterExpressions / formItem.allowExpressions.

        Comment


          #5
          But allowFilterExpressions does not seem to handle sql standard LIKE (_ %) or MATCHES (? *) operators ?
          What I am trying to achieve is consistent client/server filtering with ability to use sql like or matches wildcards.
          MichalG

          Comment


            #6
            Filesystem glob-style wildcards (eg "*foo" or "foo*bar") are supported. Matching SQL syntax is a non-goal, this interface isn't intended to be just for IT people. But you could build such support yourself - just be careful about quoting to avoid SQL injection attacks.

            Comment


              #7
              Hi,

              i have a ListGrid and set everything as following:


              ListGridField eml = new ListGridField(EmlSearchItem.EMAIL, EmlSearchItem.EMAIL_TITLE);

              emlGrid = new ListGrid();
              emlGrid.setWidth("70%");
              emlGrid.setHeight("60%");
              emlGrid.setFields(eml);
              emlGrid.setAutoFetchData(true);
              // emlGrid.setDataSource(dataSource);
              emlGrid.setSelectionType(SelectionStyle.SINGLE);
              emlGrid.setAllowFilterExpressions(true);
              emlGrid.setShowFilterEditor(true);
              emlGrid.setAutoFetchTextMatchStyle(TextMatchStyle.SUBSTRING);

              nevertheless when I enter a*com it always shows
              No Items to show.
              although I have, e.g. 12343@chat.mysite.com inside my list.

              am I missing something? and what wildcards are supported?

              BR

              Comment

              Working...
              X