Announcement

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

    Nightly build: StaticTextItem.setValue issue

    SmartGWT version: SmartGWTPro Nightly build 2010-11-22
    GWT version: 2.0.3
    Browser version: Any.



    Hi, I recently switched to a nightly build to fix another problem. However, I'm finding StaticTextItem.setValue() no longer seems to work properly.

    The following code:

    Code:
    StaticTextItem type;
    
    type.setValue("Blah blah");
    Log.debug("Value of type: " + type.getValue());
    Works without errors and the "type.getValue()" statement correctly returns "Blah blah".

    However, the field is empty in the display and when submitting the form the field is attached to, the value is null as well.

    #2
    I've done some more research on this and the issue appears to be a bit more complicated.

    I can't copy/paste all the application code; it's way too much and too complicated.... but in a nutshell...

    Code:
    DynamicForm mainForm = new DynamicForm();
    StaticTextItem type = new StaticTextItem("type","Type");
    type.setValue("Blah Blah");
    
    mainForm.setFields(type);
    [b]mainForm.editNewRecord();[/b]
    ...

    in version 2.3, this worked fine - the call to mainForm.editNewRecord() did not wipe the value that was put into the StaticTextItem type. Now (nightly build 2010-11-22), however, it does seem to remove it.

    I noticed what I believe is a new method on DynamicForm; namely:

    Code:
    public void editNewRecord(java.util.Map initialValues): Prepare to edit a new record by clearing the current set of values (or replacing them with initialValues if specified). Subsequent calls to saveData() will use an add rather than an update operation.
    Is it possible that this was added since the official release of 2.3 and that this is why the behavior has changed?
    Last edited by SiccoNaets; 23 Nov 2010, 13:33.

    Comment


      #3
      editNewRecord has been around since 1.0.

      The behavior you're now seeing for setValue, where editNewRecord gets rid of the value, is the right one. Use setDefaultValue to establish a value that the StaticTextItem will be reset to when editNewRecord is called (or the values are reset in some other way).

      The old behavior that you tripped across - that calling setValue() on a StaticTextItem would behave similarly to setDefaultValue (once only) - was a bug.

      Comment


        #4
        That makes sense, thanks Isomorphic.

        Incidentally, is there a thread or something that lists what gets fixed/changed in the nightly builds? That would a great help...

        Comment


          #5
          We roll a changelog into releases, and we have plans to automate things so that the changelog as it stands is added to nightly builds (no ETA yet).

          Comment


            #6
            Yeah, that would be very good indeed - the app I'm working on is 35000 lines of code at this point and regression testing everything gets pretty time consuming ;)

            Comment

            Working...
            X