欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

yii_wiki_204_using-cjuidialog-to-edit-rows-in-a-cgridview(通过_PHP教程

程序员文章站 2022-04-19 20:08:03
...
/*** 
Using CJuiDialog to edit rows in a CGridView   
 
http://www.yiiframework.com/wiki/204/using-cjuidialog-to-edit-rows-in-a-cgridview 
 
translated by php攻城师 
 
http://blog.csdn.net/phpgcs 
 
Scenario 
Solution 
Column hyperlink 
Javascript function 
 
**/  
  
/*** 
背景      Scenario 
***/   
  
我这里有一个 一系列的 clients/events 所属的 CGridView , 对每一行 (eventClient), 我想要实现快速的编辑 eventClient对话框。  
  
我的方法基于 这篇wiki http://www.yiiframework.com/wiki/145/cjuidialog-for-create-new-model/  
  
/*** 
 
解决方法  Solution  
 
***/  
  
首先基于 wiki 145 做了所有工作后, 再来 修改我们 的CGridView:  
  
Column hyperlink   
  
对每一列 , 在js 函数中设置 _updateComment_url 属性 为需要的 url。  
  
array(  
    'name'=>'comment',  
    'header'=>'Comments',  
    'type'=>'raw',  
    'value'=>'CHtml::link(  
        ($data["comment"]?$data["comment"]:"(comment)"),  
        "",  
        array(  
            \'style\'=>\'cursor: pointer; text-decoration: underline;\',  
            \'onclick\'=>\'{  
                updateComment._updateComment_url="\'.  
                    Yii::app()->createUrl(  
                        "eventClient/updateComment",  
                        array("id"=>$data["id"])  
                    )  
                .\'";  
                updateComment();  
                $("#dialogComment").dialog("open");}\'  
            )  
        );',  
),  
  
  
Javascript function   
  
在同一个页面我们将 调用这个 动作的 updateComment() 方法包含进来。   
  

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/477117.htmlTechArticle/*** Using CJuiDialog to edit rows in a CGridView http://www.yiiframework.com/wiki/204/using-cjuidialog-to-edit-rows-in-a-cgridview translated by php攻城师 http://blog.csdn.net/...