Announcement

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

    FilterBuilder customization options

    Hello,

    I am trying to implement the FilterBuilder component in our application. But can seem to figure out how to customize it.

    I'm mostly interested in removing some operators and changing the titles of some.

    For example:
    Click image for larger version

Name:	filter.png
Views:	244
Size:	9.0 KB
ID:	258948

    Here I would like to remove the Match None operator, rename the Match All to "AND", rename the Match Any to "OR" also I would like to remove some of the operators available for the text field.
    I don't want to use the RADIO operator appearance since we then lose the "+()" option so the setMatchAnyTitle() method does nothing for me.

    Is this possible for this or am I going to have to implement a custom GUI that does all of this?

    Thank you in advance

    #2
    Setters for the titles and available options (topOperatorOptions) are well documented, so are we missing something about your question?

    Did you try to use the APIs and have trouble? If so, you need to show your code or no one will be able to help you.

    Comment


      #3
      I figured out how to remove operators from the text field but I still cant figure out how to rename or remove the top operators.

      FilterBuilder code used:
      Code:
      FilterBuilder filterBuilder = new FilterBuilder();
      filterBuilder.setMatchAnyTitle("OR");
      filterBuilder.setMatchAllTitle("AND");
      filterBuilder.setDataSource(AdvancedSearchFilterDataSource.getInstance());
      I want to keep the top operator appearance as BRACKET and not use the RADIO.

      DataSource for the filterBuilder:
      Code:
      public AdvancedSearchFilterDataSource() {
        DataSourceTextField textField = new DataSourceTextField("textField", "textField");
        textField.setValidOperators(OperatorId.CONTAINS);
        setFields(textField);
      }
      The changes I want to make are:
      • "Match Any" to "OR"
      • "Match All" to "AND"
      • Remove "Match None"
      Last edited by thop; 8 Aug 2019, 03:32. Reason: Additional info

      Comment


        #4
        There is no call to the API we mentioned - topOperatorOptions - so this would not be expected to work.

        Is there some reason you aren’t calling the API that is documented to do what you want? Did you try, and have it not work?

        Comment


          #5
          Originally posted by Isomorphic View Post
          There is no call to the API we mentioned - topOperatorOptions - so this would not be expected to work.

          Is there some reason you aren’t calling the API that is documented to do what you want? Did you try, and have it not work?
          If you are referring to

          Code:
           filterBuilder.setTopOperatorOptions(OperatorId.AND, OperatorId.OR);
          I am using that and it did remove the Match None top operator but I still cant see a way to change the text of Match Any and Match All to OR and AND in the filter builder.

          I am looking at documentation and see no mention of it. There are the setMatchAnyTitle and setMatchAllTitle which only work if the TopOperatorApperance is set to TopOperatorAppearance.RADIO which I do not want to use as I said in the initial post.

          I don't see a way to change the strings in the dropdown when I set the TopOperatorAppearance to BRACKET.
          Am I looking at the wrong documentation maybe? Can you give me the documentation link you are referring to so I see if I can find a solution there.

          Comment


            #6
            In the case of "bracket" mode, we are using the system-wide string constant naming these operators - Operators andTitle and Operators orTitle. You could change these system-wide via the Internationalization system (https://www.smartclient.com/smartgwt...docs/I18n.html) if you want.

            Comment

            Working...
            X