文档准备好后如何绘制CGridView?我有Yii框架1.14,jquery和jquery.ui成功加载了!
Console.error!因为网格是在文档就绪后绘制的
TypeError: jQuery(...).dialog is not a function
jQuery("#dialog").dialog();
我的代码:
[
'class' => 'zii.widgets.grid.CButtonColumn',
'template' => '{edit}',
'headerHtmlOptions' => ['class' => 'col-lg-1', 'style' => 'text-align:center'],
'buttons' => [
'edit' => [
'label' => '<span class="glyphicon glyphicon-comment"></span>',
'url' => "Yii::app()->controller->createUrl('ViewComments',['key'=>\$data->key])",
'imageUrl' => null,
'options' => [
'style' => 'color: black',
'rel' => 'tooltip',
'data-toggle' => 'modal',
'data-target' => "#myModal",
'title' => 'Комментировать',
'ajax' => [
'type' => 'post',
'url' => 'js:$(this).attr("href")',
'dataType' => 'html',
'success' => 'js:function(data){
jQuery("#dialog").dialog();
}'
],
],
],
]
],
答案 0 :(得分:0)
您是否尝试在视图中重新加载js
的Yii ::应用程序() - &GT; clientScript-&GT; registerCoreScript(&#39; jquery的&#39); YII ::应用程序() - &GT; clientScript-&GT; registerCoreScript(&#39; jquery.ui&#39);