[英]ExtJs Message box sliding of message
我在extJs中遇到了这个例子。 我发现他们正在使用Ext.example.msg进行滑动。 因此,我决定将example.js文件存储在app / ext / example / example.js中
Ext.example = function(){
var msgCt;
function createBox(t, s){
return ['<div class="msg">',
'<div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>',
'<div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc"><h3>', t, '</h3>', s, '</div></div></div>',
'<div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>',
'</div>'].join('');
}
return {
msg : function(title, format){
if(!msgCt){
msgCt = Ext.DomHelper.insertFirst(document.body, {id:'msg-div'}, true);
debugger;
}
msgCt.alignTo(document, 't-t');
var s = String.format.apply(String, Array.prototype.slice.call(arguments, 1));
var m = Ext.DomHelper.append(msgCt, {html:createBox(title, s)}, true);
m.slideIn('t').pause(1).ghost("t", {remove:true});
},
init : function(){
var t = Ext.get('exttheme');
if(!t){ // run locally?
return;
}
var theme = Cookies.get('exttheme') || 'aero';
if(theme){
t.dom.value = theme;
Ext.getBody().addClass('x-'+theme);
}
t.on('change', function(){
Cookies.set('exttheme', t.getValue());
setTimeout(function(){
window.location.reload();
}, 250);
});
var lb = Ext.get('lib-bar');
if(lb){
lb.show();
}
}
};
}();
在index.html中,我添加了路径<script src="./example/example.js" type="text/javascript" ></script>
。 我将调试器保留在example.js中。 它在此行( var s = String.format.apply(String, Array.prototype.slice.call(arguments, 1));
)失败并显示消息Uncaught TypeError:无法调用undefined的方法“ apply” 。 这是什么意思 我的控制器中有一个保存按钮,
Ext.MessageBox.alert('Save', 'xxxx', showResult);
function showResult(btn){
debugger;
Ext.example.msg('Button Click', 'You clicked the {0} button', btn);
};
ExtJs 4.2中现在有什么新方法。 请提出建议。
有效。 只需包含适当的.css文件。 .css文件的位置应在index.html或任何* .html页面中指定。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.