/***
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. Sql:查看数据库表和表结构的语句

    T-sql 显示表结构和字段信息的sql语句: exec sp_help tablename; ~~使用存储过程 sp_help 显示数据库包含哪些表的sql语句: use yourDBname;se ...

  2. 指尖上的电商---(2)Solr全文搜索引擎的准备工作

    Solr是一个基于Lucene的全文搜索引擎.提供了更丰富的搜索语言.更灵活的配置.更高的查询效率. 一句话.与Lucene相比.有过之而无不及.这一节里, 主要谈论两个知识点:Jdk的安装和Tomc ...

  3. EJB3.0开发环境的搭建

    EJB Container的介绍SUN公司正式推出了EJB的规范之后,在众多的公司和开发者中引起了非常大的反响.标志着用Java开发企业级应用系统将变的非常easy.很多公司都已经推出了或正打算EJB ...

  4. SQL Server验证的两种方式

    1.Windows身份验证:本机连接或者受信的局域网连接(一般在忘记管理员密码或者做系统配置的情况下使用). 2.SQLServer验证:使用用户名.密码验证(推荐使用). 启用方法:以Windows ...

  5. 【转】CTE(公用表表达式)

    本文转自:爽朗的微笑  http://www.cnblogs.com/shuangnet/archive/2013/03/22/2975929.html 公用表表达式 (CTE) 具有一个重要的优点, ...

  6. if和switch的区别,循环的for 和while的区别, 字符串常用的7种方法

    相同点: 都是用于多重选择 不同点: 多重IF没有switch选择结构的限制,特别适合变量处于某个连续区间的情况 switch只能处理等值条件判断的情况,而且条件必须是整型变量或者字符串变量 字符串的 ...

  7. js得到分页栏

    自己写的,感觉返回html代码蠢蠢的,但是新手并不知道怎么写更好的,感觉这样子也蛮简单.记录下来,以后来越改越好. //获得分页栏.注意indexSize为奇数,这样也比较好看 //totalNum: ...

  8. BZOJ 1019: [SHOI2008]汉诺塔( dp )

    dp(x, y)表示第x根柱子上y个盘子移开后到哪根柱子以及花费步数..然后根据汉诺塔原理去转移... ------------------------------------------------ ...

  9. 第2章 Python基础语法--Hello python

    第2章 基础语法 2.1 基本介绍 2.1.1 Hello python 每个语言的开始都是从”HelloWorld”开始的,我们也不例外.打开已经安装好的Python编译环境,至于Python如何安 ...

  10. .net运行时和核心类库源码(部分源码)微软官方下载

    部分类库代码:http://referencesource.microsoft.com/download.html 运行时clr源码: http://www.microsoft.com/en-us/d ...