【问题标题】:Yii echmultiselect showing error on console and not workingYii echmultiselect 在控制台上显示错误并且无法正常工作
【发布时间】:2020-09-15 18:23:50
【问题描述】:

我在这里 https://www.yiiframework.com/extension/echmultiselect#3-use-as-a-filter-in-cgridview 关注 Option no 3,在我的 Yii 项目中添加多选下拉菜单。但它正在显示,

jquery.js:6920 Uncaught TypeError: jQuery.easing[this.easing] 不是 功能 在 init.run (jquery.js:6920)

在我的 cgridview 上,这是必须是多选复选框的列,

array (
                'name'=>'brand_id',
                'filter'=> $this->widget('ext.EchMultiSelect.EchMultiSelect', array(
                    'model' => $model,
                    'dropDownAttribute' => 'brand_id',
                    'data' => CHtml::listData(Brands::model()->findAll(array("order" => "sortOrder")), 'id', 'name'),
                    'options' => array('buttonWidth' => 80, 'ajaxRefresh' => true,'filter'=>true),
                ),
                    true // capture output; needed so the widget displays inside the grid
                ),
           ),

在我的布局上,

我已经包含了 jquery,

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

下拉页面:

因为 jQuery.easing[this.easing] 不是函数错误,所以多选功能不起作用,按照这里的建议:https://stackoverflow.com/a/12592301/1138192 我也添加了 jquery UI,但它没有即使它破坏了现有的下拉菜单也可以工作。

控制台出错:

【问题讨论】:

  • 是的,我的 jquery 和 jquery.ui 版本高于 1.11.1,我使用 &lt;?php Yii::app()-&gt;clientScript-&gt;registerCoreScript('jquery'); Yii::app()-&gt;clientScript-&gt;registerCoreScript('jquery.ui'); ?&gt; 在我的布局文件中添加了这一点

标签: javascript jquery yii


【解决方案1】:

问题出在jquery.multiselect.js (EchMultiSelect-v1.3) 因为效果方法参数是inverted(至少对于当前的 jQuery 版本):

第 566、573、600 行的.show( effect, speed ).hide( effect, speed ) 应替换为正确的顺序 .show( speed, effect ).hide( speed, effect )

【讨论】:

  • 让我检查一下先生,如果出现任何问题,我会发表评论。实际上我的 jquery 版本是 1.11.1,通过这个多选小部件加载的 jquery.ui 是 1.11.2
  • 根据您在jquery.multiselect.js 上的建议进行了更改,jquery.easing 问题消失了,但现在它显示jquery-ui.min.js:6 Uncaught TypeError: this._destroy is not a function 我需要包含 jquery.ui.min.js因为目前我使用 &lt;?php Yii::app()-&gt;clientScript-&gt;registerCoreScript('jquery'); ?&gt; 在我的布局中添加了 jquery
  • 一件事要通知你如果我手动添加 jquery.ui.min 那么下拉过滤器会在 1 次过滤后消失。所以我想我不需要包含那个 jquery.ui.min 文件,但现在我只需要删除那个控制台错误jquery-ui.min.js:6 Uncaught TypeError: this._destroy is not a function,在你建议的更改之后一切都很好。提前致谢。
  • 我尝试在 assets/jquery.multiselect.js 上进行修改,也按照此处的建议进行以下更改:yiiframework.com/extension/echmultiselect#c12023 但没有运气
  • 我怀疑 jquery.ui.widget.min.jsjquery-ui 的交互方式很奇怪,因为它取自 jquery-ui,但来自 6 岁的版本
猜你喜欢
  • 2015-03-02
  • 1970-01-01
  • 1970-01-01
  • 2020-08-24
  • 1970-01-01
  • 2022-11-05
  • 1970-01-01
  • 1970-01-01
  • 2022-01-26
相关资源
最近更新 更多