duandanbeng1829 2011-10-02 18:25
浏览 34

在MCGrid上添加动态按钮

i want to modify the line in the code below ($g->addColumn('button','check_out') to $g->addColumn('button','check_in') if the field instock is 'N'

This way the button calls a different function depending on if the tool is instock.

I do have the functions in the model as well already.

<?php
class page_index extends Page {
    function init(){
        parent::init();
        $page=$this;

        $g=$page->add('MVCGrid');

        $tool=$g->setModel('Tools',
            array('number','name','description','instock'));

        $g->addColumn('button','check_out');
        $g->addPaginator(20);
        $g->dq->order('number asc');

        if($_GET['check_out']){
            $tool->loadData($_GET['check_out']);
            $tool->check_out()->update();
            $g->js()->reload()->execute();
        }
        if($_GET['check_in']){
            $tool->loadData($_GET['check_in']);
            $tool->check_in()->update();
            $g->js()->reload()->execute();
        }       
    }
}
  • 写回答

1条回答 默认 最新

  • doushan5222 2011-10-02 21:57
    关注

    Look into implementation of format_button() inside "atk4/lib/Grid" and create your own function just like that. You'll also need to extend "Grid" to add this function.

    You will also need to look into init_button() function which slaps jQuery UI button() function on the whole column.

    评论

报告相同问题?

悬赏问题

  • ¥15 Python报错怎么解决
  • ¥15 simulink如何调用DLL文件
  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离
  • ¥30 线性代数的问题,我真的忘了线代的知识了
  • ¥15 有谁能够把华为matebook e 高通骁龙850刷成安卓系统,或者安装安卓系统
  • ¥188 需要修改一个工具,懂得汇编的人来。
  • ¥15 livecharts wpf piechart 属性
  • ¥20 数学建模,尽量用matlab回答,论文格式
  • ¥15 昨天挂载了一下u盘,然后拔了
  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题