I’m using Windows 7 on my development machine, although our server is running Linux and encountering the same issue.
I am developing in Firefox 3.6.6, but the problem occurs in IE8 as well, so it appears global.
I’m using the latest version of Yii, 1.1.3.
The issue: when using the AJAX delete button in a CButtonColumn (inside CGridView), if there are two or more buttons inside the CButtonColumn, and they share the same class, the delete AJAX action is triggered when either button is clicked.
Removing the class from either button makes things work as expected, but if the buttons share the same class name, the problem occurs.
Here is my code:
...
array(
'class'=>'CButtonColumn',
'deleteButtonLabel'=>'Remove myself from this community partner.',
'deleteConfirmation'=>'Are you sure you want to remove yourself from this community partner?', 'deleteButtonOptions'=>array('class'=>'showTooltip','height'=>'25','width'=>'25'),
'deleteButtonImageUrl'=>Yii::app()->request->baseUrl.'/images/i_logout.png',
'viewButtonImageUrl'=>Yii::app()->request->baseUrl.'/images/i_glass.png',
'viewButtonOptions'=>array('class'=>'showTooltip','height'=>'25','width'=>'25'),
'viewButtonLabel'=>'View community partner\'s profile.',
'viewButtonUrl'=>'Yii::app()->controller->createUrl("communityPartner/view",array("id"=>$data->community_partner_fk))',
'template'=>'{view} {delete}',
),
...
So in this situation, if I click the delete button, it works as expected; but if I click the view button, it triggers the delete action as well.
In case anyone is wondering, I am using the ‘showTooltip’ class to implement the jTools tooltip on these buttons. I have removed the code that generates the tooltip to ensure that wasn’t causing a conflict, so the problem is not there. The problem can be reproduced using any class name (even “Blah”, for example), whether or not jQuery was bound to that class in some way.
Any suggestions? This appears to be a bug, unless I misunderstood a concept.