【发布时间】:2017-07-11 04:06:21
【问题描述】:
在 phpgrid 中,我使用 add_column 方法添加了一个虚拟列(db 中不存在该列)。但问题是我不能让它出现在第一个位置(即表格的第一列)。 add_column 方法的文档说它将附加在其他列的末尾add_method for phpgrid。是否可以将其添加到第一列/位置?我尝试了各种 jquery hack,但似乎没有一个有用。
下面是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;
}
【问题讨论】:
标签: javascript php jquery jqgrid phpgrid