我在网格中使用selectbox形成网格。所以我想让行无法点击,因为当我尝试点击选择框时它也会触发复选框。
这就是我实现这一目标的方式。
这是我的网格构造函数,代码如下所示。它将在selectbox click上停止onrowclick事件
public function __construct()
{
parent::__construct();
$this->setId('customerGrid');
$this->setUseAjax(true); // Using ajax grid is important
$this->setDefaultSort('id');
$this->setDefaultFilter(array('customer_ids'=>1)); // By default we have added a filter for the rows, that in_products value to be 1
$this->setSaveParametersInSession(false); //Dont save paramters in session or else it creates problems
$this->setAdditionalJavaScript("
// added click on selectbox support
serializerController.prototype.rowClick = serializerController.prototype.rowClick.wrap(function(o, grid, event) {
var tagName = Event.element(event).tagName
isSelect = (tagName == 'SELECT' || tagName == 'OPTION');
if (!isSelect) {
o(grid, event);
}
});
");
}