Announcement

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

    Need to restrict TopOperator in FilterBuilder

    I'm using a FilterBuilder, and would like to restrict the TopOperator to include just the "and" and "or" operators, and exclude the "not" operator. I've looked at FilterBuilder, and see that it uses LogicalOperator to provide the operators. I don't see anyway to override or set the operations on FilterBuilder.

    Is there a way to restrict the available operators?

    Thanks,
    Chris

    #2
    Any advice on my post above?

    Thanks,
    Chris

    Comment


      #3
      checkout javadoc.
      http://www.smartclient.com/smartgwt/javadoc/

      void setTopOperator(LogicalOperator topOperator)
      Default logical operator for all top-level clauses in the FilterBuilder.

      Comment


        #4
        Thanks Karim. Wouldn't that just set the default operator? I need to remove the not operator so that it doesn't appear as an option in the drop down list.

        Chris

        Comment


          #5
          Call setTypeOperators() on the DataSource passing null for the type, and list all the operators you want, boolean and otherwise. Not the clearest API, we may add a shortcut.

          Comment


            #6
            setTypeOperators() isn't exposed on the Smart GWT Datasource. So we did this:

            Code:
            	public void setTypeOps(OperatorId...ids)
            	{
            		setTypeOps( null, JSOHelper.convertToJavaScriptArray( ids ) );
            	}
            	
              public native void setTypeOps(JavaScriptObject type, JavaScriptObject operatorArray) /*-{
              	var self = this.@com.smartgwt.client.core.BaseClass::getOrCreateJsObj()();
              	self.setTypeOperators(type,operatorArray);
            	}-*/;
            Is that what you had a mind? It seems to work when we called setTypeOps with the operators we needed.

            Thanks!

            Comment


              #7
              Yup, that works. Sorry, didn't realize setTypeOperators was missing in SGWT, we'll add it in a future release.

              Comment


                #8
                Hi,

                I have a similiar question concerning one part of the filterbuilder. Is it possible (and if, how) to remove the "between" from the operator-list of filterbuilder's DateItem?

                best, chris

                Comment


                  #9
                  Try this:

                  Code:
                  field.setValidOperators( OperatorId.EQUALS, OperatorId.LESS_THAN, OperatorId.LESS_OR_EQUAL,
                  	OperatorId.GREATER_THAN, OperatorId.GREATER_OR_EQUAL, OperatorId.IS_NULL, OperatorId.NOT_NULL );

                  Comment


                    #10
                    Originally posted by cjustice
                    setTypeOperators() isn't exposed on the Smart GWT Datasource.
                    These methods have been added.

                    Comment


                      #11
                      Thank you!

                      Comment

                      Working...
                      X