Announcement

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

    Using ListGrid object with setCanRemoveRecords set to true

    Hi,

    I Want to use a ListGrid (com.smartgwt.client.widgets.grid.ListGrid) with one ListGridField (com.smartgwt.client.widgets.grid.ListGridField)

    ListGrid myListGrid = new ListGrid();
    myListGrid.setCanRemoveRecords(true);
    ListGridField keyField = new ListGridField("key", "Key");
    setFields(keyField);

    How should I change the ListGrid class, to be able to control the removing of a record? I've already tried to override the removeData method like this:

    @Override
    public void removeData(Record record) {
    // my pre-remove code goes here
    super.removeData(record);
    }

    But it seems like that this method is not invoked when the user press the remove icon.


    Can someone help me please?

    #2
    Do you want to do something on the client side? If so your best bet is to add your own remove field and then handle it. If you only want to control how the data is removed from server-side you can set the remove function, this is a more advanced option though.

    Comment


      #3
      Thanks for the fast reply!

      I want to have both client and server side logic. If someone press the button, the data should be deleted from the database and the ListGrid also. But if something goes wrong (eg. database connection down etc.) the data must not be removed from the ListGrid, because it wasn't deleted from the DB.

      But as I understand your answer correctly, I have to add my own delete button to the Grid and add the logic to it's clickhandler.

      Comment

      Working...
      X