Clear Row/Record Button

Hi all,

I’m trying to have a button that will clean everything the row/record holds. That includes: drop down lists, checkboxes and text fields.

Thanks!

Solution:

if ( event.getSource().equals( clearButton ) )
{
     refresh();
     ListGridRecord selected = grid.getSelectedRecord();
     int edited = grid.getRecordIndex( selected );
     String[] attributes = grid.getSelectedRecord().getAttributes();
     for ( int i = 1; i < attributes.length; i++ )
     {
          if ( selected.getAttribute( attributes[i] ).equalsIgnoreCase( "true" ) )
          {
               grid.setEditValue( edited, attributes[i], "false" );
          }
          if ( selected.getAttribute( attributes[i] ).trim().length() > 1 && !selected.getAttribute( attributes[i] ).equalsIgnoreCase( "true" ) && !selected.getAttribute( attributes[i] ).equalsIgnoreCase( "false" ) )
          {
               grid.setEditValue( edited, attributes[i], "" );
          }
     }
     grid.saveAllEdits();
     refresh();
}