Announcement

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

    RowEditorExitHandler doesn't gets the edited values

    In the addRowEditorExitHandler's, there isn't a way to get the post-edited values. If I RowEditorExitEvent.getRecord, the field values returned are pre-edit values. How can I get the after edited values from the grid?

    Thanks

    #2
    The testcase to reproduce is:

    Use the example
    Instead of doing setDataSource, do a countryGrid.setData(CountryData.getRecords());
    Code:
    countryGrid.addRowEditorExitHandler(new RowEditorExitHandler(){
            	public void onRowEditorExit(RowEditorExitEvent event) {
            		System.out.println(((CountryRecord)event.getRecord()).getFieldValue("countryName"));
            	}
            });
    It prints the old cell value, whereas the the GUI shows the new value selected.
    How to get the old value programmaticaly?

    Comment


      #3
      Sorry, forgot to provide the example class name.
      Its GridEditByRowSample.java

      Comment


        #4
        You could retreive it directly from the countryGrid using the the RowNum of the object RowEditorExitEvent.

        something like that :

        Code:
        System.out.println(countryGrid.getRecord(event.getRowNum()).getFieldValue("countryName"));
        I also see that the RowEditorExitEvent exposes a method getEditValues().

        Hope it helps

        Thomas

        Comment


          #5
          Sorry, forgot to provide the example class name.
          Its GridEditByRowSample.java

          Comment


            #6
            Hi mastoo,

            Did you try running the testcase? I am getting
            Code:
            System.out.println(event.getEditValues());   === null
                    		System.out.println(((CountryRecord)countryGrid.getRecord(event.getRowNum())).getFieldValue("countryName"));  === old cell value

            Comment


              #7
              Same problem

              I have exactly the same problem.
              Did someone find a solution to obtain the current value of a cell ?

              Thanks.

              Comment


                #8
                When using a data array the save is immediate and synchronous. See the Editing Overview and the various settings that control when saving is done (autoSaveEdits, saveByCell, etc).

                Comment


                  #9
                  I found a solution to this issue :
                  To retrieve the new value of an edit cell in a ListGrid, you need to use the "addCellSavedHandler" method insted of "addRowEditorExitHandler" method.
                  The CellSavedHandler provide a method name getNewValue who gives the new value of the cell.

                  Comment


                    #10
                    That's not necessary. See the Editing Overview and note the distinction between editValues (the user's unsaved edits) and the data in the record itself.

                    Comment


                      #11
                      Hi everybody,

                      it seems i'm facing the same issue...
                      i use a ListGrid, the data is set over setData(RecordList)
                      now i want to be informed about the editing of my rows beeing able to conditionally cancel the changes
                      ListGrid.addRowEditorExitHandler seems to be the right method for that, but the RowEditorExitEvent contains only the old Record, there is a method for getting new values, it looks like
                      Code:
                      class RowEditorExitEvent
                      
                      
                      
                          /**
                           * edit values for the current row
                           *
                           * @return edit values for the current row
                           */
                          //TODO
                          public native JavaScriptObject getEditValues() /*-{
                              var jsObj = this.@com.smartgwt.client.event.AbstractSmartEvent::jsObj;
                              return jsObj.editValues;
                          }-*/;
                      but the result of this method is null, so no way to get new values ???

                      regards
                      andre


                      btw: i'm using smartgwt version 2.2 from repository http://www.smartclient.com/maven2
                      Last edited by a.reiter; 29 Sep 2010, 02:45.

                      Comment

                      Working...
                      X