/***
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>

yii_wiki_204_using-cjuidialog-to-edit-rows-in-a-cgridview(通过CJuiDialog在CGridView中修改行数据)的更多相关文章

  1. 在CGridView调用CJuiDialog的弹出层

    <?php $this->widget('zii.widgets.grid.CGridView', array(    'id'=>'user-grid',    'dataProv ...

  2. [Spark][Python]Mapping Single Rows to Multiple Pairs

    Mapping Single Rows to Multiple Pairs目的: 把如下的这种数据, Input Data 00001 sku010:sku933:sku02200002 sku912 ...

  3. SSHE框架整合(增删改查)

    1.前期准备:jar包(c3p0.jdbc ,各个框架) web.xml文件:spring的   转码的,和Struts2的过滤器 <?xml version="1.0" e ...

  4. [译]MVC网站教程(四):MVC4网站中集成jqGrid表格插件(系列完结)

    目录 1.   介绍 2.   软件环境 3.   在运行示例代码之前(源代码 + 示例登陆帐号) 4.         jqGrid和AJAX 5.         GridSettings 6.  ...

  5. SSIS 数据源组件的External Metadata和Advanced Property

    1,SSIS的组件属性ValidateExternalMetadata 如果一个Destination组件使用的是上游创建的staging table,那么必须设置 ValidateExternalM ...

  6. drupal module 自定义

    01 <?php function mytracer_menu() { $items = array(); $items['admin/config/mytracer'] = array( 't ...

  7. 【Android Api 翻译4】android api 完整翻译之Contacts Provider (学习安卓必知的api,中英文对照)

    Contacts Provider 电话簿(注:联系人,联络人.通信录)提供者 ------------------------------- QUICKVIEW 快速概览 * Android's r ...

  8. Oracle bbed使用说明2---常用命令

    一.BBED常用命令说明 先看帮助的说明 BBED> help all SET DBA [ dba | file#, block# ] SET FILENAME 'filename' SET F ...

  9. easyui-prompt弹出框操作

    效果图如下: 代码如下: $(document).ready(function () { //绑定按钮操作 $('#btnMove').click(function () { var ids = ge ...

随机推荐

  1. 帝国cms数据表详细说明

    表 名 解释 phome_ecms_infoclass_news 新闻采集规则记录表 phome_ecms_infotmp_news 采集临时表 phome_ecms_news 新闻主数据记录表 ph ...

  2. 3_Guess Fingers

    3 // // ViewController.swift // Guess Fingers // // Created by ZC on 16/1/8. // Copyright © 2016年 ZC ...

  3. DropBox为什么一直那么红——靠用户体验,旗帜鲜明,它要保存的是你的重要随身资料,并且开放API

    链接:http://www.zhihu.com/question/19705960/answer/71742127来源:知乎 看到这个问题竟然从11年答到现在,有趣的是这几年里国内云存储行业变化也是蛮 ...

  4. MFC自绘控件学习总结

    前言:从这学期开始就一直在学习自绘控件(mfc),目标是做出一款播放器界面,主要是为了打好基础,因为我基础实在是很烂....说说我自己心得体会以及自绘控件的方法吧,算是吐槽吧,说的不对和不全的地方,或 ...

  5. Android Animations动画使用详解

    一.动画类型 Android的animation由四种类型组成:alpha.scale.translate.rotate XML配置文件中 alpha 渐变透明度动画效果 scale 渐变尺寸伸缩动画 ...

  6. Flex LinkButton鼠标划过出现下划线

    在LinkButton中 textDecoration属性设置label的是否有下划线装饰,属性值分为"none","underline" 代码如下------ ...

  7. vector数据查找方法

    用STL编敲代码时常常使用vector容器来存储数据.当容器中的数据有序时我们能够採取两种方式: (1) 利用<algorithm>中的find函数进行查找: (2) 折半查找. 另外也能 ...

  8. Java程序猿JavaScript学习笔记(2——复制和继承财产)

    计划和完成在这个例子中,音符的以下序列: Java程序猿的JavaScript学习笔记(1--理念) Java程序猿的JavaScript学习笔记(2--属性复制和继承) Java程序猿的JavaSc ...

  9. mobilize扁平化的fullPage.js类工具使用心得

    可以生成一个fullPage效果的主页,但是列表页面和内容页面呢? 主页中的block,可以选择多种组建生成.甚至连form都有: 应该改造其源代码,动态化和cms系统化,添加二三级页面模板: == ...

  10. js中去除换行(\r\n)

    解决方法:replace(/\r\n/g,"").replace("\n","") 测试: <script> var str = ...