2014-09-05
/*** 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() 方法包含进来。 <script type="text/javascript"> function updateComment() { // public property var _updateComment_url; <?php echo CHtml::ajax(array( 'url'=>'js:updateComment._updateComment_url', 'data'=> "js:$(this).serialize()", 'type'=>'post', 'dataType'=>'json', 'success'=>"function(data) { if (data.status == 'failure') { $('#dialogComment div.divComment').html(data.div); // Here is the trick: on submit-> once again this function! $('#dialogComment div.divComment form').submit(updateComment); } else { $('#dialogComment div.divComment').html(data.div); setTimeout(/"$('#dialogComment').dialog('close') /",2000); // Refresh the grid with the update $.fn.yiiGridView.update('event-client-grid'); } } ", ))?>; return false; } </script>
1
CI框架连接数据库配置操作以及多数据库操作
09-05
2
asp 简单读取数据表并列出来 ASP如何快速从数据库读取大量数据
05-17
3
C语言关键字及其解释介绍 C语言32个关键字详解
04-05
4
C语言中sizeof是什么意思 c语言里sizeof怎样用法详解
04-26
5
最简单的asp登陆界面代码 asp登陆界面源代码详细介绍
04-12
6
PHP中的魔术方法 :__construct, __destruct , __call, __callStatic,__get, __set, __isset, __unset , __sleep,
09-05
7
PHP中的(++i)前缀自增 和 (i++)后缀自增
09-05
8
PHP中include和require区别之我见
09-05
常用dos命令及语法
2014-09-27
将视频设置为Android手机开机动画的教程
2014-12-11
php递归返回值的问题
2014-09-05
如何安装PHPstorm并配置方法教程 phpstorm安装后要进行哪些配置
2017-05-03
java中的info是什么意思
2022-03-24
PHP 教程之如何使用BLOB存取图片信息实例
2014-09-05
IcePHP框架中的快速后台中的通用CRUD功能框架
2014-09-05
单片机编程好学吗?单片机初学者怎样看懂代码
2022-03-21
PHP数组函数array
2014-09-05
学ug编程如何快速入门?
2022-03-17
最佳球会九游版下载v2.5.161 安卓官方版
经营养成 1.87G
下载热血传奇跨服新大陆官方手游下载v1.9.134.15150 安卓最新版本
角色扮演 1.50G
下载波比的游戏时间第四章玩家自制版(PlaytimeStarterKit)下载v9.1 安卓版
其它手游 1.14G
下载方块枪战block gun游戏下载v9.8 安卓版
射击枪战 108.8M
下载zepeto中文版(更名崽崽ZEPETO)下载v4.2.210 安卓版
休闲益智 319.7M
下载现代战舰手游下载v0.94.3.120515958 安卓手机版
射击枪战 1.96G
下载Modern Warships现代战舰国际服官方正版下载v0.94.3.120515958 安卓最新版
策略塔防 1.96G
下载2025指尖捕鱼新版下载v10.2.44.7.0 安卓正版
休闲益智 579.4M
下载指尖捕鱼赢话费版下载v10.2.44.7.0 安卓版
下载
指尖捕鱼高爆率多人捕鱼游戏下载v10.2.44.7.0 安卓版
下载
指尖捕鱼吴孟达版下载v10.2.44.7.0 安卓最新版
下载
飞机大厨2025最新版(airplane chefs)下载v12.0.2 安卓免费版
下载
捕鱼大决战狂暴版官方版下载v122.7.286 安卓高爆版
下载
捕鱼大决战最新版本下载v122.7.286 安卓正版
下载
捕鱼大决战深海版游戏下载v122.7.286 安卓版
下载
拳皇14官方正版下载v2.0.0 安卓正式版
下载