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

右侧链接位置:

底部按钮位置:


实现原理:

在_List()方法之后,赋值$this->mytable数组,格式如下:

$this->mytable = [            'foot_tpl' => '', // 底部按钮字符串            'link_tpl' => '', // 右侧链接字符串            'link_var' => 'html = html.replace(/\{id\}/g, row.id);html = html.replace(/\{id\}/g, row.id);', // 右侧链接的js变量替换,例如{id}表示id,可以写多组js赋值        ];

赋值完毕后,传入到模板解析:

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

最终效果代码:


右侧链接示例代码:

$this->mytable = [ 'foot_tpl' => '', // 底部按钮字符串 'link_tpl' => '', // 右侧侧链接字符串 'link_var' => 'html = html.replace(/\{id\}/g, row.id);', // 侧链接的js变量替换,例如{id}表示id];// 侧链接,加一个a标签链接$this->mytable['link_tpl'].= '';\Phpcmf\Service::V()->assign([ 'mytable' => $this->mytable,]);

底部按钮示例代码:

$this->mytable = ['foot_tpl' => '', // 底部按钮字符串'link_tpl' => '', // 右侧链接字符串'link_var' => 'html = html.replace(/\{id\}/g, row.id);', // 右侧链接的js变量替换,例如{id}表示id];// 底部按钮// 加入多选框按钮$this->mytable['foot_tpl'].= '';// 加入删除按钮$this->mytable['foot_tpl'].= '';// 加入新的按钮$this->mytable['foot_tpl'].= '            ';\Phpcmf\Service::V()->assign([ 'mytable' => $this->mytable,]);
发表评论
留言与评论(共有 0 条评论) “”
   
验证码:

相关文章

推荐文章