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

    ListGrid and SaveByCell option

    SmartGWT 3.1 LGPL

    Hi guys,

    I have a dialog window with:
    a) ListGrid with a local datasource (autoSaveEdits=true, saveByCell=true).
    b) "Save" button with a clickHandler.

    I edit a value in a cell and click on the "Save" button.
    It seems that the click handler is executed before the ListGrid saves the edited record in the datasource.
    As a result, when I inspect datasource records - I see the old values.

    Is it possible to make the ListGrid to save the edited record in the datasource first?

    P.S. I tried to call ListGrid.saveAllEdits() in the ClickHandler - it didn't help.

    Hi serge_hid,

    did you see that there are ListGrid.saveAllEdits()-overloads with a Callback?

    Best regards,


      Hi Blama,

      Thank you, now I'm using ListGrid.saveAllEdit(Function) and it works fine when ListGrid.saveAutoEdits is set to false.

      If ListGrid.saveAutoEdits is set to true (no matter, saveByCell is true or false) and I call ListGrid.saveAllEdits() in the button click handler, the datasource recieves two ADD DSRequests from the ListGrid (I checked that by overriding DataSource.getClientOnlyResponse()) - and the "datasource duplicate key error" as a result.

      The problem occurs only if I click on the "Save" button while editing one of the ListGrid cells. If I focus out of the cell/row (by pressing Enter or clicking on some empty space out of the grid) and click on the "Save" button - everything works fine, because autoSaveEdits mode makes the grid to save changes to datasource first and I can see/inspect them in the button click handler.

      Is it possible to make the ListGrid to save changes automatically to the datasource before the button click handler is called (if I click the button while editing of the grid cells/rows)?
      Last edited by serge_hid; 19 Feb 2014, 23:16.



        Could you please help with this problem?

        I think it's quite a common situation to have a ListGrid (with a 'clientOnly' datasource) and a button with the clickHandler which we inspect the data from the datasource in.

        Thanks in advance.