联系官方销售客服

1835022288

028-61286886

应用插件 版主:官方插件技术组
想在后台的全局表单内容列表里,操作选项里加一个右侧链接按钮
类型:迅睿CMS 更新时间:2024-04-09 23:03:59 列表右侧链接 全局表单
插件 全局表单 V2.4
应用作者 迅睿官方团队
发布时间 2021-03-24 10:37:32
更新时间 2024-04-28 11:11:28

想在后台的全局表单内容列表里,操作选项里加一个右侧链接按钮,参考了

Table操作类-列表右侧链接和底部按钮写法

https://www.xunruicms.com/doc/1232.html

后台模块控制器继承重写

https://www.xunruicms.com/doc/1352.html


我的代码是这样的

// 数据列表
public function index() {
 $tpl = $this->_Admin_List(true);
 $this->mytable = [
  'foot_tpl' => '', // 底部按钮字符串
  'link_tpl' => '', // 右侧侧链接字符串
  'link_var' => 'html = html.replace(/\{id\}/g, row.id);', // 侧链接的js变量替换,例如{id}表示id
 ];

 // 侧链接,加一个a标签链接
 $this->mytable['link_tpl'].= '<label><a href="'.dr_url(APP_DIR.'/customer/show').'&id={id}" class="btn btn-xs blue"> <i class="fa fa-user"></i> 测试</a></label>';

 \Phpcmf\Service::V()->assign([
  'mytable' => $this->mytable,
 ]);
 return \Phpcmf\Service::V()->display($tpl);
}

为什么只剩下侧链接一个按钮了?没加侧链接代码之前数据列表正常显示的。

QQ图片20240409083427.png

插件教程:https://www.xunruicms.com/doc/app-710.html

回帖
  • 开源社区插件技术-小鹏
    #1楼    开源社区插件技术-小鹏
    2024-04-09 08:39:53
    Chrome 0
    // 数据列表
    public function index() {
     $tpl = $this->_Admin_List(true);
    
    
     // 侧链接,加一个a标签链接
     $this->mytable['link_tpl'].= '<label><a href="'.dr_url(APP_DIR.'/customer/show').'&id={id}" class="btn btn-xs blue"> <i class="fa fa-user"></i> 测试</a></label>';
    
     \Phpcmf\Service::V()->assign([
      'mytable' => $this->mytable,
     ]);
     return \Phpcmf\Service::V()->display($tpl);
    }
  • 求知若渴虚心若愚
    #2楼    求知若渴虚心若愚
    2024-04-09 13:35:31
    Chrome 0
    开源社区插件技术-小鹏 图标显示正常了,数据列表还是无法显示
    QQ图片20240409133338
  • 求知若渴虚心若愚
    #3楼    求知若渴虚心若愚
    2024-04-09 13:42:48
    Chrome 0
    list($tpl) = $this->_List();能显示数据列表,但是左侧那些按钮图标又不显示了。。。。
  • 开源社区插件技术-小鹏
    #4楼    开源社区插件技术-小鹏
    2024-04-09 14:14:54
    Chrome 0
    // 数据列表
    public function index() {
     $tpl = $this->_Admin_List(true);
    
     $this->mytable = \Phpcmf\Service::V()->get_value("mytable");
     // 侧链接,加一个a标签链接
     $this->mytable['link_tpl'].= '<label><a href="'.dr_url(APP_DIR.'/customer/show').'&id={id}" class="btn btn-xs blue"> <i class="fa fa-user"></i> 测试</a></label>';
    
     \Phpcmf\Service::V()->assign([
      'mytable' => $this->mytable,
     ]);
     return \Phpcmf\Service::V()->display($tpl);
    }
    满意答案
  • 求知若渴虚心若愚
    #5楼    求知若渴虚心若愚
    2024-04-09 23:03:59
    Chrome 0
    @开源社区插件技术-小鹏:已解决,多谢小鹏