Yii - Jquery.fn.yiigridview Throwing Undefined Error When I Want To Call Update() Function
In my view I have the following widget: $this->widget('bootstrap.widgets.TbGridView', array( 'dataProvider' => $model->search(), 'filter' => $model, 'ajaxUp
Solution 1:
I think jquery
is reloaded when you call the renderPartial
in your actionCreate()
. Try changing the parameters of the call to
$this->renderPartial('_form', array(...), false, false);
Or add the following code to _form
to prevent jquery (and maybe other javascript files) from being reloaded.
<?phpif (Yii::app()->request->isAjaxRequest) {
$cs = Yii::app()->clientScript;
$cs->scriptMap['jquery.js'] = false;
$cs->scriptMap['jquery.min.js'] = false;
}
?>
When jquery is reloaded it forgets everything it knew before. So the yiiListView
doesn't exist anymore.
Solution 2:
Found this answer, and the solution worked for me:
Put this code into your main config file under "components":
'clientScript' => array(
'scriptMap' => array(
'jquery.js' => '/path/to/your/jquery/file.js',
),
),
And add this to the head of your main view file (view/layouts/main):
<?php Yii::app()->clientScript->registerCoreScript('jquery'); ?>
This solved the issue.
Post a Comment for "Yii - Jquery.fn.yiigridview Throwing Undefined Error When I Want To Call Update() Function"