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 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀