私が使用した解決策は、 Grid のフォーマットタイプを追加することです: lib/Grid/advenced.php
にスマートボタンを追加しました:
function init_smartButton($field){
@$this->columns[$field]['thparam'].=' style="width: 40px; text-align: center"';
$this->js(true)->find('.button_'.$field)->button();
}
function format_smartButton($field){
$product = $this->add('Model_Product')->load($this->current_id);
if($product->acceptButton($field))
{
$this->current_row_html[$field]='<button type="button" class="'.$this->columns[$field]['button_class'].'button_'.$field.'" '.
'onclick="$(this).univ().ajaxec(\''.$this->api->url(null,
array($field=>$this->current_id,$this->name.'_'.$field=>$this->current_id)).'\')">'.
(isset($this->columns[$field]['icon'])?$this->columns[$field]['icon']:'').
$this->columns[$field]['descr'].'</button>';
}else{$this->current_row_html[$field]='';}
$product->destroy();
}
これは通常のボタンと同じですが、製品で許可されている場合にのみボタンを作成します。
次に、私のグリッドで:
$grid->setModel('Model_Product')->addCondition('buyer_id','=',$userID);
$grid->addColumn('smartButton' ,'1');
$grid->addColumn('smartButton' ,'2');
$grid->addColumn('smartButton' ,'3');
$grid->addColumn('smartButton' ,'4');
$grid->addColumn('smartButton' ,'5');
$grid->addPaginator(5);
完璧ではありませんが、今のところ問題ありません。より良い提案があれば、喜んで改善します。