This is how the behavior in ext js.
I did it by keeping track of selected rows, on GridCellListener and
GridHeaderListener
Here is the sample code :
//selectedRowId is a simple ArrayList, which holds the row position in
grid
grid.addGridCellListener(new GridCellListenerAdapter(){
public void onCellClick(GridPanel grid, int rowIndex,
int colindex,
EventObject e) {
RowSelectionModel rowSelectionModel =
grid.getSelectionModel();
Integer rowInt = new Integer(rowIndex);
if(selectedRowId.contains(rowInt)){
selectedRowIds.remove(rowInt);
}else{
selectedRowIds.add(rowInt);
}
if(colindex != 0){
grid.getSelectionModel().clearSelections();
int[] selectedRowIdsPrem =
getSelectedRowIdsPremitive(selectedRowIds); // this function converts
list of Integer into int[]
rowSelectionModel.selectRows(selectedRowIdsPrem);
}
}
});
grid.addGridHeaderListener(new GridHeaderListenerAdapter() {
public void onHeaderClick(GridPanel grid, int colIndex,
EventObject
e) {
selectedRowIds.clear();
if(grid.getSelectionModel().getSelections().length > 1){
for(int i = 0; i<
grid.getSelectionModel().getSelections().length; i ++){
selectedRowId.add(new
Integer(i));
}
}
}
});
I am also interested to know if there is any better solution.
-Bakul Kumar
On Sep 3, 8:18 am, siaroslaw <[EMAIL PROTECTED]> wrote:
> Hi,
> I would like to know how to change the current selection behviour in
> the grid panel with the checkbox selection model. Let's say I have a
> list (grid) of items. There is a checkbox to left of each item.
> Clicking on a checkox controls the state of one item only (checked /
> unchecked). But when I click on the item (not a checkbox), the
> currently selected item becomes checked, and other items get
> unchecked. I want to make the clicking on an item act the same as
> clicking on a checkbox.
>
> Thanks!
> siaroslaw
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"GWT-Ext Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/gwt-ext?hl=en
-~----------~----~----~----~------~----~------~--~---