在Yii中通过jquery调用模态窗口失败

我试图在我的yii应用程序中添加模态窗口。 为此,我使用框架中的jquery。 然而,它不适用于框架中的jquery(1.8.3): framework / web / js / source
错误是:
未捕获的TypeError:对象[object Object]没有方法’modal’
在这一行:

$('#dataModal').modal().css({ width: 'auto', height: 'auto', }); 

(参见下面的完整代码)。
当我将modal()交换到dialog()时也会发生同样的情况。

然而,当我尝试通过googleapis上传最新的jquery(1.10.2)时将其注册为客户端脚本,它可以工作(虽然每个视图调用只有一次): config / main.php:

 'components'=>array( ... 'clientScript'=>array( 'packages'=>array( 'jquery'=>array( 'baseUrl'=>'//ajax.googleapis.com/ajax/libs/jquery/1/', 'js'=>array('jquery.min.js'), ), ), ), 

并在视图中注册:

 Yii::app()->clientScript->registerCoreScript('jquery'); 

与此案有关的完整代码如下:

  beginWidget('bootstrap.widgets.TbModal', array('id'=>'dataModal')); ?>    endWidget(); ?>  ...  // this function calls the modal thru AJAX $('#data-select-btn').click(function(){ var buttn = this; // $(buttn).button('loading'); $.ajax({ url: "createAbsoluteUrl('order/loadData') ?>", /*LoadDataCheckBox*/ cache: false, data: "type="+$("#Order_type").val(), success: function(html){ $(".modal-body").html(html); //$(buttn).button('reset'); $('#dataModal').modal().css({ width: 'auto', height: 'auto', 'margin-top': '-50px', 'margin-left': function () { return -($(this).width() / 2) - 80; }, }); } }); })  

对于Jquery-ui,这些也包括在内:

   

更新

至于Yii bootstrap扩展我确实使用它,在bootstrap.js中有模态类定义和插件定义。 这个文件是在jquery之后加载的,但在jquery-ui之前, 序列是否重要?

  ...  

视图文件的结尾:

   

试试这个……在order/loadData确保你的renderPartial没有第二次加载脚本。

 $this->renderPartial('view_partial', array( 'model' => $model, ), false, false); 

http://www.yiiframework.com/doc/api/1.1/CController#renderPartial-detail

顺序很重要。

你应该首先加载jquery,然后加载jquery-ui,thw bootsttrap.js

尝试在registerScript中指明位置:

 Yii::app()->clientScript->registerCoreScript('jquery', CClientScript::POS_HEAD); 

更多信息: http : //www.yiiframework.com/doc/api/1.1/CClientScript#registerScriptFile-detail

以及如何包含jQuery UI?

===编辑===尝试使用以下命令更改config / main中脚本的顺序:

 'components'=>array( ... 'clientScript' => array( 'coreScriptPosition' => CClientScript::POS_END, ) ), 

如果没有任何效果,只需禁用自动编码:

 'clientScript' => array( 'scriptMap'=>array( 'jquery.js'=>false, 'jquery.min.js'=>false ), ), 

然后装载就像过去一样;)