Yii cGridView更新错误“TypeError:$ .fn.yiiGridView未定义”

时间:2014-07-25 05:28:19

标签: javascript php ajax yii model

我在gridview update

时遇到错误
TypeError: $.fn.yiiGridView is undefined;

使用AjaxLink后

按钮单击“刷新”

<script>
$(document).ready(function(){
  $("#tombol_refresh").click(function(){
    $.fn.yiiGridView.update('mdata-pribadi-grid'); 
  });
}); 
</script>

AjaxLink

<?php
echo CHtml::ajaxLink(
    'Open New',          // the link body (it will NOT be HTML-encoded.)
    array('mDataPribadi/create'), // the URL for the AJAX request. If empty, it is assumed to be the current URL.
    array(
            'update'=>'#req_res',
    )
);
echo '<div id="req_res">...</div>';
?>

按钮刷新

<button id="tombol_refresh">Refresh</button>

cGridView

<?php $this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'mdata-pribadi-grid',
    'dataProvider'=>$model->search(),
    'filter'=>$model,
    'columns'=>array(
        'nim',
        'nama',
        'tempat_lahir',
        'tgl_lahir',
        'kode_program_studi',
        'kode_pendidikan_akhir',
        array(
            'class'=>'CButtonColumn',
        ),
    ),
)); ?>

感谢

法查尔

1 个答案:

答案 0 :(得分:0)

jQuery和Yii都使用$。在jQuery函数中使用$时,$指的是jQuery脚本而不是Yii脚本。您需要使用jQuery的另一个符号来解决这两个问题。

请参阅http://api.jquery.com/jquery.noconflict/