/*** 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 attacker http://blog.csdn.net/phpgcs Scenario Solution Column hyperlink Javascript function *** // *** background Scenario ***/me here there is a series of clients/events CGridView, for each line (eventClient), I want to implement a quick edit eventClient dialog box. My approach is based on this wiki http://www.yiiframework.com/wiki/145/cjuidialog-for-create-new-model//*** Solution ***/first after doing all the work based on wiki 145, then modify our CGridView: for each Column, Column hyperlink sets the _ updateComment_url attribute as the required url in the js function. 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 Functions include the updateComment () method that calls this action on the same page. <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', 'ype ype '=> 'json', 'success' =>" function (data) {if (data. status = 'failed') {$ ('# dialogComment div.divcomment'cmd.html (data. div); // Here is the trick: on submit-> once again this function! $ ('# DialogComment div. divComment form '). submit (updateComment);} else {$ ('# dialogComment div.divcomment'cmd.html (data. div); setTimeout (\ "$ ('# dialogComment '). dialog ('close') \ ", 2000); // Refresh the grid with the update $. fn. yiiGridView. update ('event-client-grid') ;}} ",)?>; Return false ;}</script>