Announcement

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

    FilterBuilder -> limit showSubClauseButton

    Hi,

    I am using FilterBuilder in my SmartClient application.
    What I want is to set a limit on "SubClauseButton". i.e. this button should appear only at the outer most node and not in the inner heirarchy.
    (I want to give the support for one level of parenthesis, and not the nested parenthesis support.)

    Is there any way to achieve this ?
    Thanks in advance...

    #2
    Any Suggestions....

    Comment


      #3
      Hi i faced the same problem and created maxSubClauseDepth property and used it while initializing widget.


      Code:
      //CustomFilterBuilder class
      
      isc.defineClass("CustomFilterBuilder", "FilterBuilder").addMethods({
      	    initWidget: function(){
      	        var undef;
      	        if (this.maxSubClauseDepth == undef) {
      	            if (this.creator != undef) {
      	                this.maxSubClauseDepth = this.creator.maxSubClauseDepth - 1;
      	                if (this.maxSubClauseDepth == 0) {
      	                    this.showSubClauseButton = false;
      	                }
      	            }
      	        }
      	        this.Super("initWidget", arguments);
      	    }
      	});
      
      
              var testData = [];	
      	for (var i = 0; i <= 200; i++) {
      	    testData[i] = {
      	        name: "field" + i,
      	        title: "Field " + i,
      	        type: "text"
      	    };
      	}	
      	
      	isc.DataSource.create({
      	    ID: "bigFilterDS",
      	    clientOnly: true,
      	    fields: [{
      	        name: "name",
      	        type: "text"
      	    }, {
      	        name: "title",
      	        type: "text"
      	    }, {
      	        name: "type",
      	        type: "text"
      	    }],
      	    testData: testData
      	});
      	
      	isc.CustomFilterBuilder.create({
      	    ID: "advancedFilter",
      	    fieldDataSource: "bigFilterDS",
      //using maxSubClauseDepth to restrict depth of subclauses
      	    maxSubClauseDepth: 3,
      	    criteria: {
      	        _constructor: "AdvancedCriteria",
      	        operator: "and",
      	        criteria: [{
      	            fieldName: "field2",
      	            operator: "iStartsWith",
      	            value: "C"
      	        }, {
      	            operator: "or",
      	            criteria: [{
      	                fieldName: "field73",
      	                operator: "notEqualField",
      	                value: "field191"
      	            }, {
      	                fieldName: "field130",
      	                operator: "iContains",
      	                value: "B"
      	            }]
      	        }]
      	    }
      	});

      Comment

      Working...
      X