Announcement

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

    ListGrid cancelEditing/endEditing problem

    Hello!

    I have the following problem:
    I have a grid and I want to edit rows and add new rows inline.

    I have a button that calls the startEditingNew(); method and a new row is added to the grid with text boxes, as expected.
    I have a button to save the new row, and works fine.
    I have a button to cancel editing, that does not hide the new row...

    Using SmartGWT 2.5 and Chrome.

    Can anyone help?
    agalvao

    Code:
    // THE BUTTONS
            refDataCancel.addClickHandler(new ClickHandler() {
                
                @Override
                public void onClick(ClickEvent event) {
                    // Does not hide the new row
                    //grid.getGrid().cancelEditing();
                    grid.getGrid().endEditing();
                    refDataAdd.show();
                    refDataCancel.hide();
                    refDataSave.hide();
                }
            });
            refDataAdd.addClickHandler(new ClickHandler() {
                
                @Override
                public void onClick(ClickEvent event) {
                    grid.getGrid().startEditingNew();
                    refDataAdd.hide();
                    refDataCancel.show();
                    refDataSave.show();
                }
            });
            
            refDataSave.addClickHandler(new ClickHandler() {
                
                @Override
                public void onClick(ClickEvent event) {
                    String key = grid.getGrid().getEditedRecord(0).getAttribute("key");
                    String value = grid.getGrid().getEditedRecord(0).getAttribute("value");
                    if(key != null && !key.isEmpty() 
                           && value != null && !value.isEmpty()) {
                        // Save -> works fine
                    
                        refDataAdd.show();
                        refDataCancel.hide();
                        refDataSave.hide();
                    }
                    else {
                        // Show error
                    }
                }
            });
Working...
X