- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在 View 中扩展 MessageBox,以便我可以在整个应用程序中重用它。
似乎当我这样做时,我失去了一些使消息框有用的默认功能(消息、按钮定义、图标定义、默认拖动约束等)。文档有点困惑,因为它似乎应该在 show() 函数中定义配置,而且我不确定如何在我的 View 中设置它们。
如何才能真正将 messagebox 组件扩展为 View ?
基本消息框(我想用我的 View 创建的内容):
Ext.Msg.show({
title:'Error',
msg: 'There was an error.',
buttons: Ext.Msg.YESNOCANCEL,
icon: Ext.Msg.QUESTION
});
渲染:
但是当我展示我的观点时:
Ext.create('IOL.view.app.Message').show();
我基本上得到了一个普通的面板/窗口组件
Ext.define('IOL.view.app.Message', {
extend : 'Ext.window.Window',
config: {
},
constructor: function(config) {
this.initConfig(config);
this.callParent(arguments);
},
initComponent : function() {
Ext.apply(this, {
xtype: 'messagebox',
width: 400,
height: 200,
title:'Error',
html: 'There was an error.',
buttons: [
{ text: 'Button 1' }
]
});
this.callParent(arguments);
}// initComponent
});
渲染:
最佳答案
看来您正在扩展 Ext.window.Window
并将消息框配置应用于它。为什么不延长 Ext.window.MessageBox
:
Ext.define('IOL.view.app.Message', {
extend : 'Ext.window.MessageBox',
width: 400,
height: 200,
title: 'Error',
html: 'There was an error.',
buttons: Ext.Msg.YESNOCANCEL,
icon: Ext.Msg.ERROR,
// whatever else you want to do
initComponent : function() {
this.callParent(arguments);
}
});
@EricCook 在下面提出了一个很好的观点。 MessageBox
类旨在作为单例在应用程序中重用,而不是真正用于子类化。
在你的问题中你说:
I'm trying to extend a MessageBox within a view so I can reuse it throughout my application
我可以理解,如果您想创建一个不同的类型 消息框,您可以用普通的Ext.Msg.show
调用它。方法,您可以扩展 MessageBox
我想有你自己的按钮或图标。
但对于常规使用,这不是您需要扩展的东西。为了在您的应用中重复使用,您可以在 Controller 中保留对您想要的消息框配置的引用,例如:
// SomeController.js
errorMsg: {
title:'Error',
msg: 'There was an error.',
buttons: Ext.Msg.YESNOCANCEL,
icon: Ext.Msg.QUESTION
},
然后每当你想调用你可以使用的那种类型的消息时(假设作用域是 Controller 本身,或者你可以事先获得对 Controller 的引用):
Ext.Msg.show(this.errorMsg);
关于javascript - 将 MessageBox 扩展为 View - Ext JS 4.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12163842/
图书馆 EXT-JS 、 EXT-CORE 、 EXT-GWT 之间有什么区别,因为我在 ext-js 上工作所以请用外行语言解释我:) 最佳答案 最初它只是 Ext JS。作为 3.x 的一部分,E
我在 Ext 窗口中有 Ext GridPanel。为了使 Ext Window Resizeable,我将它的属性设置为 true 并且它工作正常。 但是,还想让网格可以调整大小。因此,为此我也尝试
我想构建一个网络应用程序。每当我在 Linux 终端发出命令时 $ sencha app build 在构建应用程序时,我遇到了一些与依赖相关的问题。错误类似于 Failed to resolv
我正在开发一个由 domain.ext 提供的网络应用程序。此 Web 应用程序使用基于 cookie 的 session ,并为用户提供在子域上托管包含自定义 JavaScript 的网页的能力,例
我正在尝试设置 LAMP使用 docker 的 web 服务器,很高兴发现 php 上的好人已经放在一起了a docker container for php . 通过阅读文档,我发现了三个表面上可以
美好的一天,伙计们, 我知道这听起来像是一个愚蠢的问题。但是,我想知道是否有人可以向我解释之间的区别。外网和 EXT.JS .. 我一直试图理解它们,但结果为零。据我所知,EXT.NET集成了EXT.
与常规 Ext.ajax 调用相比,Ext.direct 的主要优点是什么?我什么时候应该考虑使用一种而不是另一种? 最佳答案 实际上,这取决于您的后端、您想要做什么以及适合您的情况。你提出的问题相当
Ext.extend 和 Ext.override 有什么区别?在java中,你扩展一个类并覆盖它的方法。但是看看语法,似乎在 extjs 中,你既可以扩展一个类,也可以覆盖一个类 最佳答案 Ext.
我是 Ext Js 新手。我有以下文件结构。 我正在测试以下代码 - First Ext Js Page
我正在使用修改后的kanderson-well beats委托版本来修改AVKit需要的请求。所有代码将在帖子的底部。修改请求、创建字幕播放列表并将它们添加到主播放列表中是很好的,因为它们在请求AVM
我无法使用 Ext.namespace() 访问对象。 返回错误类型错误:Company.Test 不是函数 一直在查看文档但仍然无法使用对象。 这是命名空间脚本 Ext.namespace('Com
首先,我的问题是我想知道 Ext.Define() 和 Ext.Create() 之间有什么不同, 我想知道如何以正确的方式使用它们。 我查看了我的代码和许多 Extjs4 MVC 教程, 我在 Ex
我们正在使用 ext.net 版本 5.2.0,据我了解,它包括 Ext JS 7.2.0.67。我正在使用看起来像这样的 slider 控件 ext.net 5.2 Slider: https://
我刚刚使用 Ext JS 和 Ext Gantt 技术在我们的 .NET (WebForms) 项目中完成了甘特图页面的开发。正如我在之前的 post 中所述,效果很好。 我现在的问题是,与 hte
在我的 ExtJS 4.0.7 应用程序中,我需要动态加载一些第 3 方 javascript,以呈现某些面板内容(一些精美的图表/可视化小部件)。 我遇到了一个古老的问题,即在我尝试使用它之前脚本没
使用 ext-all.js 和 ext-all-debug.js 有什么区别? 从 debug.js 更改为 ext-all.js 会提高性能吗? 我可以假设从调试切换到普通文件不会对应用程序产生任何
我是在服用疯狂的药丸,还是这两件事几乎相同? 最佳答案 在这一点上花了大量时间使用这两个框架后,我会说它们并不“非常相同”。虽然它们可能都使用相同的图形 Assets ,但它们实现的方式却大不相同,并
我正在使用 Ext.form.Panel ,其配置如下: defaultType : 'textfield', layout : 'auto', height : '60%', w
我想重写 this从 Ext3 到 Ext4 的教程。但是从我能够观察到的情况来看,createDelegate 函数已被删除(可能与许多其他事情一样)并且它不起作用。我试过调用 call/apply
目标: 仅在需要时加载 Ext 框架(JS 文件)。 问题: 在稍后的状态下加载 Ext.JS 时,Ext.onReady 不会触发。我试着解决 Ext.onReady,但我也没有开始工作。我很高兴有
我是一名优秀的程序员,十分优秀!