Announcement

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

    listGrid: edited value is not included on saveAllEdits

    I have a listGrid.
    I have a button that calls saveAllEdits() on the listGrid.

    Recently, I have noticed that if I am currently editing a field in the ListGrid, and press the button, then the value currently edited is omitted from the resulting DSRequest call. (And thus, the operation fails, since the given field has no default value.)

    If I do a getEditedRecord(0) on the ListGrid, the result is the same: the currently edited value is omitted.

    If I press enter first, (so that the editor is hidden, and the edited value is shown), and then press the save button, the value is included in the request.

    I think this behavior is new: the same component used to work fine with SmathGWT 2.0 Pro, but it broke after I switched to SmartGWT-EE Eval nightly build.

    * * *

    Is this the intended behavior?
    If yes, what do I have to do so that the currently edited value is included in the save?

    Thank you for your help!

    #2
    The issue seems to be more complicated that I have described it above. I will post further detail after some more debugging.

    Comment


      #3
      OK, here is what I found:

      I start editing the grid with ListGrid.startEditingNew(values),
      where values is a Map<String, Object>

      The first time I do this, everything is OK.

      (I can save the record.)

      The next time I do this, some attributes are lost.
      (They don't make it into the record.)

      Here is how I test:

      Code:
      Window.alert("Starting editing with " + newValues);
      grid.startEditingNew(newValues);
      dumpRecord(grid.getEditedRecord(0));
      dumpRecord is just an utility function to display the contents of the record. (BTW, Is there an easy built-in way for this?)

      * * *

      So, when I start editing using the above snippet, I can see that the second time I do this, some arguments are not made part of the edited new record. (They are shown as part of newValues, but the dumped record does not contain them.)

      Comment


        #4
        After some more testing, I think the error might be in the getEditedRecord method (or one of the functions it calls), because when I try to dump the record content just before saving it, it _DOES_ contain the field which was not shown in the previous dump (when starting to edit), and it's missing the currently edited field. Because the previously missing field is shown now, this means that is was there all along, just the getEditedRecord() method did not pick it up then. Just like it does not pick up the edited field later.

        so to sum this up, getEditedRecord

        - when starting to edit, omits one of the fields supplied via startEditingNew(map)
        - when trying to save, omits the currently edited field.

        I tried to hope that it's just my dumping function which omits these values, but the server also complains because of the missing value (and the save fails), so the value is really missing.

        Comment


          #5
          Originally posted by csillag
          I think this behavior is new: the same component used to work fine with SmathGWT 2.0 Pro, but it broke after I switched to SmartGWT-EE Eval nightly build.
          To verify this, I migrated back to SmartGWT 2.0, but it's still broken, so there must be some other reason.

          Any idea?

          Comment


            #6
            It's intended; the grid is capable of issuing saves while editing continues, so to cause the value currently being edited to be committed before saving, call endEditing() first.

            Comment


              #7
              I have noticed that this error only happens when the field (that should hold the lost value) is hidden (with hideField)

              If it's hidden, the error is encountered the second time when I call startEditingNew().

              Comment


                #8
                Originally posted by Isomorphic
                It's intended; the grid is capable of issuing saves while editing continues, so to cause the value currently being edited to be committed before saving, call endEditing() first.
                Please let me repeat:

                1. The behavior is different when I call startEditingNew the first time. This
                time, the currently edited value is included in the save, too.

                2. Some values are also missing when I call getEditedRecord, at two different places of the process a) right after startEditNew b) before saving. Is that intended, too?

                Comment


                  #9
                  Originally posted by Isomorphic
                  to cause the value currently being edited to be committed before saving, call endEditing() first.
                  OK, it does work if I cann endEditing() first,
                  but I still don't understand why does it work the first time even without endEditing(), and why does getEditerRecord omits values.

                  Comment


                    #10
                    Can you add code to a sample that would reproduce this issue with the startEditingNew values not being saved?

                    Comment


                      #11
                      I must work real hard now to meet a really tight deadline.
                      After I am there, I will.

                      Comment

                      Working...
                      X