Yii cGridView更新有错误"TypeError: $.fn.yiiGridView是未定义的


Yii cGridView Update having Error "TypeError: $.fn.yiiGridView is undefined"

我有一个错误与gridview更新

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',
        ),
    ),
)); ?>

感谢

Fajar

jQuery和Yii都使用$。当您在jQuery函数中使用$时,$指的是jQuery脚本,而不是Yii的。您需要使用jQuery的另一个符号来消除冲突。

见http://api.jquery.com/jquery.noconflict/