thaiat
10-03-2007, 03:36 PM
Hi Everyone,
I'm not sure this is really a bug cause the initial post see here (http://extjs.com/forum/showthread.php?p=59080#post59080)
was more like a workaround
If you use this workaround against framework 2.0 then it breaks the look of the message box (see the attachement)
Here is a simple code to reproduce the bug:
HTML:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../resources/css/ext-all.css">
<script type="text/javascript" src="../adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../ext-all-debug.js"></script>
<script type="text/javascript" src="test.js"></script>
</head>
<body id="body">
<div style="width:200px">
<div id="content" >
<h2 class="wrapped" style="text-align: center; font-size: 20px;">This is a title</h2>
<br />
<p>This is some text.</p>
<p>This is some text.</p>
<p>This is some text.</p>
<p>This is some text.</p>
<p>This is some text.</p>
</div>
</div>
<br/>
<div id="button"></div>
</body>
</html>
and here is the js
Ext.onReady( function() {
// this is the workaround so it's possible to use the following syntax : Ext.get('foo').boxWrap("x-box-blue");
Ext.Element.boxMarkup = '<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"></div></div></div><div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>';
Ext.override(Ext.Element, {
boxWrap : function(cls) {
cls = cls || 'x-box';
var el = Ext.get(this.insertHtml('beforeBegin', String.format('<div class="{0}">'+Ext.Element.boxMarkup+'</div>', cls)));
el.child('.x-box-mc').dom.appendChild(this.dom);
return el;
}
});
Ext.get("content").boxWrap();
Ext.get('title').boxWrap('x-box-blue');
var o = new Ext.Button({ applyTo:'button',text:'This is my button'});
o.on("click" , function() {
Ext.Msg.alert('Status', 'Changes saved successfully.');
});
});
Also note that the simple syntax Ext.get("foo").boxWrap().replaceClass("x-box" , "x-box-blue"); does not work anymore with 2.0
I hope this can be solved... also another possibility would be to change the HTML so everything is encapsulated into a DIV with style 'x-box-blue' but it would be much simpler to achieve that in the code.
Cheers
Thierry
I'm not sure this is really a bug cause the initial post see here (http://extjs.com/forum/showthread.php?p=59080#post59080)
was more like a workaround
If you use this workaround against framework 2.0 then it breaks the look of the message box (see the attachement)
Here is a simple code to reproduce the bug:
HTML:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../resources/css/ext-all.css">
<script type="text/javascript" src="../adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../ext-all-debug.js"></script>
<script type="text/javascript" src="test.js"></script>
</head>
<body id="body">
<div style="width:200px">
<div id="content" >
<h2 class="wrapped" style="text-align: center; font-size: 20px;">This is a title</h2>
<br />
<p>This is some text.</p>
<p>This is some text.</p>
<p>This is some text.</p>
<p>This is some text.</p>
<p>This is some text.</p>
</div>
</div>
<br/>
<div id="button"></div>
</body>
</html>
and here is the js
Ext.onReady( function() {
// this is the workaround so it's possible to use the following syntax : Ext.get('foo').boxWrap("x-box-blue");
Ext.Element.boxMarkup = '<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"></div></div></div><div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>';
Ext.override(Ext.Element, {
boxWrap : function(cls) {
cls = cls || 'x-box';
var el = Ext.get(this.insertHtml('beforeBegin', String.format('<div class="{0}">'+Ext.Element.boxMarkup+'</div>', cls)));
el.child('.x-box-mc').dom.appendChild(this.dom);
return el;
}
});
Ext.get("content").boxWrap();
Ext.get('title').boxWrap('x-box-blue');
var o = new Ext.Button({ applyTo:'button',text:'This is my button'});
o.on("click" , function() {
Ext.Msg.alert('Status', 'Changes saved successfully.');
});
});
Also note that the simple syntax Ext.get("foo").boxWrap().replaceClass("x-box" , "x-box-blue"); does not work anymore with 2.0
I hope this can be solved... also another possibility would be to change the HTML so everything is encapsulated into a DIV with style 'x-box-blue' but it would be much simpler to achieve that in the code.
Cheers
Thierry