Announcement

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

    DynamicForm getField in compiled mode

    This is all too strange:


    Code:
    FormItem field = parentForm.getField(fieldName);
    Logger.debug("Found error on '"+fieldName+"' with title '" + field.getTitle()+"'" +
    		" J:" + JSOHelper.getAttribute(field.getJsObj(), "title")
    		+" C:" + JSOHelper.getAttribute(field.getConfig(), "title"));
    In dev mode, the lines give me my expected title,
    but in compiled mode, they are all null !


    Compiled mode output:
    Code:
    Found error on 'eventDateTime' with title 'null' J:null C:null
    Dev mode does give me the correct title:
    Code:
    Found error on 'eventDateTime' with title 'Event Date Time' J:Event Date Time C:Event Date Time

    So to check, I looped all my fields manually like this,
    and for my expected field, I do get my expected title in compiled mode:
    Code:
    for (FormItem formField : parentForm.getFields()) {
    	Logger.debug("field '"+formField.getName()+"' title '"+formField.getTitle()+"'");
    }
    output in compiled mode:
    Code:
    ...
    field 'eventDateTime' title 'Event Date Time'
    ...
    which is ok and expected title.


    So it seems that DynamicForm.getField behaves differently in compiled mode?

    FireFox 4
    SmartGWT EE SC_SNAPSHOT-2011-07-26

    #2
    There's no difference in behavior coded anywhere in SmartGWT between compiled mode and hosted mode. You may have tripped on an obscure GWT bug (core GWT not SmartGWT) or your IDE might somehow just be running different code in compiled vs hosted mode due to some kind of misconfiguration.

    If you can isolate this to a test case we can look at, let us know.

    Comment


      #3
      The problem was in a deployed environment on different machines, not in IDE compiled mode.

      The workaround of looping the fields via form.getFields() instead of using form.getField(name) works OK.

      I'll try later for a standalone repro.

      Comment


        #4
        Sorry for not trying to get a standalone case.

        I saw the same now for ListGrids.

        Traversing "field : grid.getFields() where field.getName() == fieldName", I can get the field.getTitle() OK.
        But grid.getField(fieldName).getTitle() returns null.

        Pretty strange,
        but this same workaround works OK :)

        Comment

        Working...
        X