Ext JS 4.2.0 Test
用於測試 Ext JS 4.2.0 的基礎程式碼
HTML
<link rel="stylesheet" href="http://cdn.sencha.com/ext/gpl/4.2.0/resources/css/ext-all.css">
<button id="show-btn">Show Window</button>
JavaScript
Ext.require([
'Ext.tab.*',
'Ext.window.*',
'Ext.tip.*',
'Ext.layout.container.Border'
]);
function showResult(btn){
Ext.example.msg('Button Click', 'You clicked the {0} button', btn);
}
Ext.onReady(function(){
var win,
button = Ext.get('show-btn');
button.on('click', function(){
if (!win) {
win = Ext.create('widget.window', {
title: 'Layout Window',
closable: true,
closeAction: 'hide',
//animateTarget: this,
width: 400,
height: 250,
layout: 'border',
bodyStyle: 'padding: 5px;',
items: [{
region: 'west',
title: 'Navigation',
width: 200,
split: true,
collapsible: true,
floatable: false
}, {
region: 'center',
xtype: 'tabpanel',
items: [{
title: 'Bogus Tab',
html: 'Hello world 1',
items:[{xtype:'button',height:100,width:100,html:'testbutton'}]
}, {
title: 'Another Tab',
html: 'Hello world 2'
}, {
title: 'Closable Tab',
html: 'Hello world 3',
closable: true
}]
}]
});
}
button.dom.disabled = true;
if (win.isVisible()) {
win.hide(this, function() {
button.dom.disabled = false;
});
} else {
win.show(this, function() {
button.dom.disabled = false;
});
}
});
});