Domanda

I would like to ask for your help to solve the following problem.

I have a SmartGwt ListGrid wich has multiple rows in it. This ListGrid has a SelectionChangedHandler which works just fine.

I added a special column (ListGridField) to this ListGrid, on which basically I want to prevent the selectionChangeEvent to trigger when clicked.

This special column has its own recordclickHandler.

I only want to EXCLUDE this column form changing the selected record in the ListGrid.

Is there any way to do so in your knowledge?

Thanks in advance.

È stato utile?

Soluzione

Since the event for row selection doesn't tell you which cell you clicked on, hence no way of telling which column, I think you'll need to make cells selectable, and ignore the event if the cell is in the excluded column.

myGrid.setCanSelectCells(true);

myGrid.addCellSelectionChangedHandler(new CellSelectionChangedHandler() {
  public void onCellSelectionChanged(CellSelectionChangedEvent event) {  
    CellSelection selection = countryGrid.getCellSelection();

    //use to determine if excluded column is clicked:
    int[][] selectedCells = selection.getSelectedCells();

    //use to get selected row: 
    ListGridRecord record = selection.getSelectedRecord();

    //etc...
  }
}  
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top