[英]Changing the position of virtual column phpgrid
在phpgrid中,我使用add_column
方法添加了虛擬列(db中不存在的列)。 但是問題是我無法使其顯示在第一位置(即表格的第一列)。 有關add_column
方法的文檔說,它將附加在phpgrid的其他列add_method的末尾 。 是否可以將其添加到第一列/位置? 我嘗試了各種jquery hacks,但似乎沒有用。
以下是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;
}
最后一個參數指示列的位置。
$dg->add_column('total', array('name'=>'total', 'index'=>'total', 'width'=>'100', 'align'=>'right', 'sortable'=>false,
'formatter'=>$col_formatter),
'Total (Virtual)', 0);
這應該將虛擬列放在索引0(第一列)上。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.