/***
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. OpenStack_Swift源代码分析——Object-auditor源代码分析(1)

    1 Object-auditor 的启动 Object-auditor的启动和object-replicator的启动过程是一样的,首先是运行启动脚本 swift-init object-audito ...

  2. Sql缓存依赖--数据库缓存

    •依赖于文件内容CacheDependency cDep = new CacheDependency(filePath); •依赖于数据库内容(轮询机制/通知机制)一:轮询机制 1.在数据库新建版本表 ...

  3. 加特殊符号星号斜杠反斜杠/* \ */ !important等让css实现兼容各个浏览器的技巧的代码

       在编写css样式表的时候常常会碰到一写浏览器兼容的问题,象是不同内核的浏览器显示就不一定相同,不同版本的的浏览器也会产生上下兼容的问题,如何解决这些问题成了我们苦恼的问题,如果你对css hac ...

  4. 学习validate

    jQuery Validate (转自http://www.w3cschool.cc/jquery/jquery-plugin-validate.html?utm_source=tuicool) jQ ...

  5. C# 模拟提交带附件(input type=file)的表单

    今天调用某API时,对于文档中的传入参数:File[] 类型,感觉很陌生,无从下手! 按通常的方式在json参数中加入file的二进制数据提交,一直报错(参数错误)!后来经过多方咨询,是要换一种 表单 ...

  6. hadoop序列化机制与java序列化机制对比

    1.采用的方法: java序列化机制采用的ObjectOutputStream 对象上调用writeObject() 方法: Hadoop 序列化机制调用对象的write() 方法,带一个DataOu ...

  7. 英文:known good board ( KGB) / 中文:测试用标准板,黄金板

    作为标准部件提供的.完全符合设计电气性能的在制板,可以作为与其它印制板比较的标准.

  8. KbmMW资源汇总(更新中…)

    KbmMW框架是收费的,不在此提供下载,如需购买,请自行联系作者Kim Madsen. 网址资源: 官网主页:http://www.components4programmers.com/product ...

  9. 生成唯一32位ID编码代码Java(GUID)

    源码下载链接:http://pan.baidu.com/s/1jGCEWlC 扫扫关注"茶爸爸"微信公众号 坚持最初的执着,从不曾有半点懈怠,为优秀而努力,为证明自己而活. /* ...

  10. gzip解压压缩的字符串数据

    import urllib2 from StringIO import StringIO import gzip def loadData(url): request = urllib2.Reques ...