duanmen8491 2019-02-27 08:49
浏览 274

Sweetalert被yii2中的bootstrap alert / confrim消息框覆盖

Problem (see title)

Yii2: Replace default confirmation message used by Gridview with Sweet alert describes the initial problem and the fix that used to work. Now the fix no longer works. Something has changed in either bootstrap or kartik yii2-dialog that makes the work around for sweetalert in yii2 no longer a working workaround. :-)

The js/yii_overrides.js is loaded in, but the function are not used by yii’s event handler.

The javascript functions for ‘confirm’ that is used by the yii event handler points to yii2-dialog (kartik).

This can be found by running console.log(window.yii); when the document is ready.

Question: How does one disable kartik-v/yii2-dialog?

(the packages is required in composer by yii2-detail-view, yii2-grid and yii2-tree-manager (all kartik versions) as revealed by composer why kartik-v/yii2-dialog)

Perhaps disabling yii2-dialog is not the best solution to the problem, input is more than welcome. :-)

System:

Yii2-advanced app PHP Version 7.2.11 Yii Version 2.0.17-dev sweetalert Version 1.1.3 kartik-v/yii2-dialog Version 1.05

Tried:

Yii2: Replace default confirmation message used by Gridview with Sweet alert

When yii\bootstrap\BootstrapPluginAsset’ => [‘js’=>[]], is added to bundles in assetManager in components in (common\config\main.php) The result is the desired sweetalert alert message, but then bootstrap modal and other things from bootstrap stop working. If that line is not added then only the bootstrap alert message box comes up, and not the sweetalert message box.

(the line used above was taken from the following stackoverflow: Yii2 disable Bootstrap Js, JQuery and CSS ) Thank you for your time. Any help or pointers would be greatly appreciated.

  • 写回答

1条回答 默认 最新

  • dongxie5698 2019-03-27 12:58
    关注

    in frontend bootstrap.php:

    \Yii::$container->set('kartik\dialog\Dialog', ['overrideYiiConfirm' => false]);
    

    it is a global override.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何实验stm32主通道和互补通道独立输出
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题