在phpgrid中,我使用add_column方法添加了一个虚拟列(db中不存在列)。但问题是,我不能使它出现在第一个位置(即表的第一列)。add_column方法的文档表示,它将被追加到其他列的末尾phpgrid方法。是否可以将其添加到第一列/位置?我尝试了各种jquery黑客,但似乎都没有用。
下面是add_column的代码
PHP代码
$dg->add_column("custom", array('name' => 'custom',
'index' => 'custom',
'width' => '100',
'formatter' => '###customAction###',
'formatoptions' => array('keys' => true, 'editbutton' => true, 'delbutton' => true)), 'Custom Action');JAVASCRIPT代码
function customAction(cellValue, options, rowdata) {
output = '<span class="custom-action"><i class="glyphicon glyphicon-plus custom" data-transaction-id="' + options.rowId + '"></i></span>';
return output;
}发布于 2017-02-21 22:49:16
最后一个参数指示列的位置。
$dg->add_column('total', array('name'=>'total', 'index'=>'total', 'width'=>'100', 'align'=>'right', 'sortable'=>false,
'formatter'=>$col_formatter),
'Total (Virtual)', 0);这应该将虚拟列放到索引0,第一列。
https://stackoverflow.com/questions/42368936
复制相似问题