payu2107 / zii

Automatically exported from code.google.com/p/zii
0 stars 0 forks source link

CGridView - afterAjaxUpdate / beforeAjaxUpdate handlers are never called #15

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create widget
<?php 
$this->widget('GoGridView', array(
     'dataProvider'=>$dataProvider,
     'selectableRows'=>2,
     'columns'=>$columns,
     'beforeAjaxUpdate' => 'js:function(id) {alert("before");}',
     'afterAjaxUpdate' => 'js:function(id, data) {alert("after");}',
 ));
?>
2. Do sorting or pagination

What is the expected output? What do you see instead?
Expected output is two alerts.
Parameters 'beforeAjaxUpdate' and 'afterAjaxUpdate' are passed to
$.fn.yiiGridView, but javascript part has no such parameters (appropriate
parameters named beforeUpdate and afterUpdate).

What version of the product are you using? On what operating system?
yii-1.1rc.r1585 on Windows XP

Please provide any additional information below.

Original issue reported on code.google.com by seb....@gmail.com on 22 Dec 2009 at 12:24

GoogleCodeExporter commented 8 years ago
The same problem exists with CListView.
Also initially ajax update not worked for me, fixed as described here -
http://www.yiiframework.com/forum/index.php?/topic/5658-yii-grid/page__view__fin
dpost__p__31978

Original comment by seb....@gmail.com on 29 Dec 2009 at 12:14

GoogleCodeExporter commented 8 years ago
Index: lib/yii/zii/widgets/assets/gridview/jquery.yiigridview.js
===================================================================
--- lib/yii/zii/widgets/assets/gridview/jquery.yiigridview.js   (revision 204)
+++ lib/yii/zii/widgets/assets/gridview/jquery.yiigridview.js   (working copy)
@@ -58,8 +58,8 @@
        tableClass: 'items',
        selectableRows: 1
        // updateSelector: '#id .pager a, '#id .grid thead th a',
-       // beforeUpdate: function(id) {},
-       // afterUpdate: function(id, data) {},
+       // beforeAjaxUpdate: function(id) {},
+       // afterAjaxUpdate: function(id, data) {},
        // selectionChanged: function(id) {},
    };

@@ -123,16 +123,16 @@
                $.each(settings.ajaxUpdate, function() {
                    $('#'+this).html($(data).find('#'+this));
                });
-               if(settings.afterUpdate != undefined)
-                   settings.afterUpdate(id, data);
+               if(settings.afterAjaxUpdate != undefined)
+                   settings.afterAjaxUpdate(id, data);
            },
            error: function(XMLHttpRequest, textStatus, errorThrown) {
                alert(XMLHttpRequest.responseText);
            }
        }, options || {});

-       if(settings.beforeUpdate != undefined)
-           settings.beforeUpdate(id);
+       if(settings.beforeAjaxUpdate != undefined)
+           settings.beforeAjaxUpdate(id);
        $.ajax(options);
    };

Original comment by and...@hellstrom.org on 8 Mar 2010 at 3:14

GoogleCodeExporter commented 8 years ago
I cannot reproduce this bug in 1.1.4. I get both alerts as expected.

Original comment by w3b0id3@gmail.com on 16 Nov 2010 at 11:16