Announcement

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

    SelectItem with SimpleType

    Hi,

    previous builds I tried always crashed the hosted mode when I clicked the pulldown icon on a SelectItem, SmartGWT EE build from 2010-11-25 finally gives me some more information:
    Code:
    com.smartgwt.client.core.JsObject$SGWT_WARN: 14:11:22.109:TMR6:WARN:Log:Error:
    	''this.pickList.getField(...).$720' is null or not an object'
    	in http://127.0.0.1:8888/zzz/sc/modules/ISC_Forms.js
    	at line 1937
        PickList.formatPickListValue(_1=>"P place", _2=>"309", _3=>Obj)
        PickListMenu.$315(_1=>"P place", _2=>Obj, _3=>Obj{name:309}, _4=>0, _5=>0)
        ListGrid.getCellValue(_1=>Obj, _2=>0, _3=>0, _4=>[GridBody ID:isc_PickListMenu_0_body])
        [o]GridBody.getCellValue(record=>Obj, rowNum=>0, colNum=>0, gridBody=>[GridBody ID:isc_PickListMenu_0_body])
        GridRenderer.$22k(_1=>Obj, _2=>0, _3=>0)
        GridRenderer.getTableHTML(_1=>undef, _2=>undef, _3=>undef, _4=>undef, _5=>undef, _6=>undef)
        GridRenderer.getInnerHTML(undef)
        Class.invokeSuper(_1=>null, _2=>"getInnerHTML", _3=>undef, _4=>undef, _5=>undef, _6=>undef, _7=>undef, _8=>undef, _9=>undef, _10=>undef)
        Class.Super(_1=>"getInnerHTML", _2=>Obj{length:1}, _3=>undef)
        GridBody.getInnerHTML(undef)
        Canvas.$px(_1=>undef)
        Canvas.$p8(_1=>true)
        Canvas.draw(_1=>undef, undef, undef, undef, undef, undef, undef, undef)
        ** recursed on Class.invokeSuper
    Though I'm not sure if I can do anything about it myself. Any in-depth explanation would be great as I then maybe can figure out these errors in future myself.

    I've checked the JS source code, and I guess it's this function in form\PickList.js and I assume "_isGeneratedField" is null in my case:
    Code:
        formatPickListValue : function (value,fieldName,record) {
            // apply standard formatter to the value in the single generated field for
            // standard pick lists.
            // This handles formatters applied via simpleType as well as any
            // 'formatValue()' method applied to this item
            if (this.pickList.getField(fieldName)._isGeneratedField) {
                return this._formatDataType(value);
            }
            return value;
        },
    
    
    
    _isGeneratedField ::
            // hang a flag on the field object as being auto-generated.
            // in this case we'll assign our custom formatter to it.
            // Otherwise the user is on their own.
            fieldObj._isGeneratedField = true;
    Custom formatter? Yes, zzzEnum extends SimpleType by super("zzzEnum", FieldType.ANY) and uses the same custom SimpleTypeFormatter which is used for setNormalDisplayFormatter and setShortDisplayFormatter.

    The field is then also bound to a custom editor which extends ComboBoxItem and has a custom setEditorValueFormatter and setInputTransformer.



    My DS definition of the field:
    Code:
    <field zzzId="309" name="locationTypeEnumID" title="locationType" type="zzzEnum" javaClass="zzz.zzzEnum" crud="15" >
    <valueMap>
    <value ID="445">P place</value>
    <value ID="446">Motorway</value>
    </valueMap>
    </field>

    SmartGWT EE 2010-11-25 hosted mode IE8.
    In IE8 compiled mode, no JS error seems to occur, the dropdown just doesn't show.
    Last edited by levi; 28 Nov 2010, 02:08.

    #2
    This suggests, actually, that getField() is returning null, and if you look at the arguments to formatPickListValue in the stack trace, this appears to be because it's being passed "309" as the fieldName, which is some kind of internal ID of yours, and the real fieldName is "locationTypeEnumID". So probably somewhere your code has gotten confused about the fieldName vs this internal ID "309".

    Comment


      #3
      Oops, you're right, but it's because I pasted the wrong DS definition. This is the field used in the form to show the value, which has name=="309":
      Code:
      <field name="309" title="Location type" dataMapping="237.locationTypeEnumID" type="zzzEnum" javaClass="zzz.zzzEnum" crud="15" >
      	<valueMap>
      		<value ID="445">P place</value>
      		<value ID="446">Motorway</value>
      	</valueMap>
      </field>
      (Field dataMapping maps to the DS field "locationTypeEnumID" pasted before.)

      Comment


        #4
        Ah, so it's got nothing to do with the customization.
        Here's a standalone case which gives the same crash when I click the dropdown, IE8 32 bit Win XP hosted mode:
        Code:
        DynamicForm form = new DynamicForm();
        DataSource ds = new DataSource();
        DataSourceTextField field = new DataSourceTextField("309", "Location type");
        LinkedHashMap<String, String> linked = new LinkedHashMap<String, String>();
        linked.put("445", "P place");
        linked.put("446", "Motorway");
        field.setValueMap(linked);
        ds.setFields(field);
        form.setAutoFetchData(false);
        form.setDataSource(ds);

        Comment


          #5
          I tried this sample in IE 8 hosted mode and it works fine. Make sure you are using the latest build as there was a fix related to this on the 25th (fix present in 26th's build).

          Sanjiv

          Comment


            #6
            Hi Sanjiv,

            just tried with SmartGWT/2.x/EnterpriseEval/2010-11-28 IE8 Hosted Mode and now I don't get the stacktrace error anymore, instead 'something' crashes and the application is restarted (I think IE just reloads the page). This is again the same behavior as I mentioned in my first post.

            FireFox hosted mode does not show this problem, and I don't think it happens in IE8 either in compiled mode.

            Comment


              #7
              levi, this is an extremely basic sample, if it didn't work there would be many, many people talking about it. Please look for something abnormal about your SmartGWT install and/or IDE setup.

              Comment

              Working...
              X