CGidView: CButtonColum + selectionChanged not possible ?

Situation: a CGridView with a few normal columns and a CButtonColumn.

When the user clicks a row, an ajax call loads a popup in a div.

That works fine.

But when the user clicks a button in the CButtonColumn, the grid also runs the selectionChanged code and at the same time the button tells the brower to follow its url (the button is a simple link). So for every click on a button, the server gets an ajax call to load a popup and a normal request for a page.

Is there a way to prevent the grid from running selectionChanged when the user actually clicked a button ? Or is it possible in the selectionChanged code to find out which column is clicked ?

I cannot believe I am the first one with this problem, but googling did not help.

BINGO! Found it.

Normally the CButtonColumn will set a class "button-column" on the td-element. The grid then ignores this column and will not launch selectionChanged.

BUT!

When setting the htmlOptions of the CButtonColumn with whatever property, the class does not get set. Then the grid and the button will both fire.

Solution: do not set any htmlOption on CButtonColumn. Or if you do, also add ‘class’=>‘button-column’.