<html>
<head>
<title>VBox Layout</title>
- <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css"/>
-
- <!-- GC -->
- <!-- LIBS -->
- <script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
- <!-- ENDLIBS -->
-
- <script type="text/javascript" src="../../ext-all.js"></script>
+ <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
+ <link rel="stylesheet" type="text/css" href="../shared/example.css" />
+ <script type="text/javascript" src="../../bootstrap.js"></script>
<style type="text/css">
html, body {
</style>
<script type="text/javascript">
Ext.onReady(function() {
-
- var replace = function(config){
+ var currentName;
+ var replace = function(config, name) {
var btns = Ext.getCmp('btns');
- btns.remove(0);
- btns.add(config);
-
- btns.doLayout();
- }
-
+ if (name && name != currentName) {
+ currentName = name;
+ btns.remove(0);
+ btns.add(Ext.apply(config));
+ }
+ };
- var viewport = new Ext.Viewport({
+ var viewport = Ext.create('Ext.Viewport', {
layout:'border',
items: [{
xtype:'button',
text: 'Button 1'
},{
- xtype:'spacer',
+ xtype:'tbspacer',
flex:1
},{
xtype:'button',
text: 'Button 4',
margins:'0'
}]
- });
+ }, 'spaced');
}
},{
xtype:'button',
xtype:'button',
text: 'Button 1'
},{
- xtype:'spacer',
+ xtype:'tbspacer',
flex:1
},{
xtype:'button',
text: 'Button 2'
},{
- xtype:'spacer',
+ xtype:'tbspacer',
flex:1
},{
xtype:'button',
text: 'Button 3'
},{
- xtype:'spacer',
+ xtype:'tbspacer',
flex:1
},{
xtype:'button',
text: 'Button 4',
margins:'0'
}]
- });
+ }, 'multi spaced - align left');
}
},{
xtype:'button',
xtype:'button',
text: 'Button 4'
}]
- });
+ }, 'align left');
}
},{
xtype:'button',
xtype:'button',
text: 'Button 4'
}]
- });
+ }, 'align center');
}
},{
xtype:'button',
xtype:'button',
text: 'Button 4'
}]
- });
+ }, 'align stretch');
}
},{
xtype:'button',
defaults:{margins:'0 0 5 0'},
items:[{
xtype:'button',
- text: 'Button 1'
+ text: 'Jamie'
},{
xtype:'button',
- text: 'Button 2'
+ text: 'Aaron'
},{
xtype:'button',
- text: 'Button 3'
+ text: 'Tommy'
},{
xtype:'button',
- text: 'Button 4'
+ text: 'Ed '
}]
- });
+ }, 'align stretchmax');
}
}]
},{
flex:1,
margins:'0'
}]
- });
+ }, 'align flex even');
}
},{
xtype:'button',
flex:3,
margins:'0'
}]
- });
+ }, 'align flex ratio');
}
},{
xtype:'button',
flex:3,
margins:'0'
}]
- });
+ }, 'align flex + stretch');
}
},{
xtype:'button',
xtype:'button',
text: 'Button 4'
}]
- });
+ }, 'align pack start + align center');
}
},{
xtype:'button',
text: 'Button 4',
margins:'0'
}]
- });
+ }, 'align pack center + align center');
}
},{
xtype:'button',
text: 'Button 4',
margins:'0'
}]
- });
+ }, 'align pack end + align center');
}
}]
}]