Announcement

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

    Getting formula fields to display as canEdit:false

    Hi, we want Formula Fields to display as canEdit:false in List grids. I've tried to figure out how to do this with no luck. It seems like this should be the default setting with perhaps the ability to override and set canEdit:true for the rare instances where someone would want to edit the output of a formula. That would basically make the formula worthless so I would think canEdit:false is a more reasonable default.

    I first tried to get a list of grid.completeFields but I didn't see the formula fields in the list. So, the formula fields must be getting added at some point I haven't yet determined from looking at the code.

    Here are the patches I tried to force canEdit:false. I can see the formula field getting set to canEdit:false briefly with these patches but it seems to get set back to canEdit:true after setViewState is called on a grid.

    So, any suggestions on how to make this happen?



    Code:
    	isc.FormulaBuilder.getPrototype().addProperties({
    		
    		getCompleteValueObject:function(){
    			
    			var _1=this.getUsedFields(),_2=this.generateFunction(),_3={canEdit:false,sortNormalizer:_2,$65w:_2,type:this.fieldType,userFormula:{text:this.getValue(),formulaVars:{}}},_4=this.getFieldIdProperty();
    			if(this.allowEscapedKeys)_3.userFormula.allowEscapedKeys=true;
    			for(var i=0;i<_1.length;i++){var _6=_1.get(i);_3.userFormula.formulaVars[_6.mappingKey]=_6[_4]}
    			return _3;
    
    		},
    		
    		
    		getBasicValueObject:function(){var _1=this.getUsedFields(),_2={canEdit:false,text:this.getValue(),formulaVars:{}},_3=this.getFieldIdProperty();if(this.allowEscapedKeys)_2.allowEscapedKeys=true;for(var i=0;i<_1.length;i++){var _5=_1.get(i);_2.formulaVars[_5.mappingKey]=_5[_3]}
    		return _2},
    			
    		getUpdatedFieldObject:function(){return isc.addProperties(this.field,{canEdit:false,title:this.getTitle()},this.getCompleteValueObject())}
    
    	
    	})

    #2
    Formula fields are canEdit:false by default - just try the sample in the Feature Explorer (latest build) and enable editing.

    Comment


      #3
      I tried the following asking the question. I went to this example:
      http://www.smartclient.com/docs/8.2/a/system/reference/SmartClient_Explorer.html#customColumns

      I changed the grid to canEdit:true. Then, clicked Try It and added a Formula Field. The Formula Field shows up as editable. I'm looking for a way to force the Formula fields to be canEdit:false even if the grid is canEdit:true. I think that should be the default behavior but it doesn't seem to be. So, how can I make the formula fields canEdit:false in this example? I want the other fields to be editable just not the Formula fields.

      Comment


        #4
        It is the default, but you need to use the latest patched build of 8.2, and the website has the release version.

        Comment


          #5
          I'm using an 8.2 build from August 15th. Are you saying you changed this default behavior in the last 2 weeks? If it was before then, there may be something else going on we need to figure out. If it was changed in the last 2 weeks, I'll download the latest and confirm.

          Comment


            #6
            We've revisited this and it appears that you are correct - formula fields are editable by default, and should not be.

            We've made a change to the codebase to reverse this. Please try the next nightly build (Aug 30 or greater)

            Regards
            Isomorphic Software

            Comment


              #7
              Works great, thanks.

              Comment


                #8
                I have another question about Formula Fields along the same lines so this seems like a reasonable place to ask it.

                We have a few grids that display a lot of columns. As a result, we set overflow:visible on all of our grid fields and this ensures that they never display too small to see when there are lots of visible columns.

                We need some way to set this value on Formula Fields as well. When we add one, they are often showing up very small because we haven't figured out how to set overflow:visible on the fields. Any ideas?

                Comment


                  #9
                  Nevermind, I just realized I can do exactly what I need by calling overflow:visible inside the Grid.setFields method.

                  Comment


                    #10
                    Just a note that autoFitFieldWidths and related properties basically obsolete the technique of setting overflow:visible.

                    Comment

                    Working...
                    X