Change with multi selection

Mar 19, 2010 at 1:56 PM

I have EnableMultiSelection enabled.

I have a column with checkboxes.

Is it possible to select more than one row and change the state of the checkboxes for the selected rows with one mouse click?

 

Thanks,

Richard

Coordinator
Mar 20, 2010 at 9:32 AM

Yes. You should create your own controller, and catch "on checked" event, and then loop through all selected rows and make all other checkboxes selected

Mar 22, 2010 at 10:33 AM

I still don't understand it. I created a controller like

SourceGrid.Cells.Controllers.CheckBox controllerCB = new SourceGrid.Cells.Controllers.CheckBox();

controllerCB.CheckedChanged += new EventHandler(controllerCB_CheckedChanged);

and I added the controller to all the CheckBox cells.

When I select some rows and check a CheckBox, all the rows get deselected. After that the event is catched in

private void controllerCB_CheckedChanged(object sender, System.EventArgs e)

The sender is of type SourceGrid.Cells.Controllers.CheckBox.

At that moment I don't know:

1.) which cell was checked/unchecked

2.) its actual value

3.) the previously selected rows

 

What am I doing wrong?

Coordinator
Mar 22, 2010 at 11:38 AM

Hi Richard,

 

Actually i am wrong, it is not that easy to make it. The thing is that when you select a number of checkboxes, each click on a check box acts like a normal click on the cell, which in turn de-selects all the previously selected cells.

 

So it would be possible to catch the cell click event and then prevent de-selecting.  This might be somewhat not that easy to do, though.

 

Mar 22, 2010 at 1:12 PM

As far as I can see the deselection is before the OnClick event. So now I don't know which rows were selected.