首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >更改虚拟列phpgrid的位置

更改虚拟列phpgrid的位置
EN

Stack Overflow用户
提问于 2017-02-21 13:41:26
回答 1查看 196关注 0票数 0

在phpgrid中,我使用add_column方法添加了一个虚拟列(db中不存在列)。但问题是,我不能使它出现在第一个位置(即表的第一列)。add_column方法的文档表示,它将被追加到其他列的末尾phpgrid方法。是否可以将其添加到第一列/位置?我尝试了各种jquery黑客,但似乎都没有用。

下面是add_column的代码

PHP代码

代码语言:javascript
复制
$dg->add_column("custom", array('name'          => 'custom',
                                'index'         => 'custom',
                                'width'         => '100',
                                'formatter'     => '###customAction###',
                                'formatoptions' => array('keys' => true, 'editbutton' => true, 'delbutton' => true)), 'Custom Action');

JAVASCRIPT代码

代码语言: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;
    }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-02-21 22:49:16

最后一个参数指示列的位置。

代码语言:javascript
复制
$dg->add_column('total', array('name'=>'total', 'index'=>'total', 'width'=>'100', 'align'=>'right', 'sortable'=>false,
    'formatter'=>$col_formatter),
        'Total (Virtual)', 0);

这应该将虚拟列放到索引0,第一列。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42368936

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档