Utilisation E.g. La table ne doit pas être de 800 pixels mais 100% de la largeur de l'écran, et chaque case pas 200 pixels mais 25%. P> p> Voici le code: p> ext.panel code> et la table code> code>, j'ai pu créer une mise en page exactement comme je veux. Cependant,
<script type="text/javascript">
clearExtjsComponent(targetRegion);
var table_wrapper2 = new Ext.Panel({
id: 'table_wrapper2',
baseCls: 'x-plain',
renderTo: Ext.getBody(),
layout:'table',
layoutConfig: {columns:2},
defaults: {
frame:true,
width:200,
height: 200,
style: 'margin: 0 10px 10px 0'
},
items:[{
title:'Shopping Cart',
width: 400,
height: 290,
colspan: 2
},{
title:'Invoice Address',
width: 190,
height: 100
},{
title:'Delivery Address',
width: 200,
height: 100
}
]
})
var table_wrapper = new Ext.Panel({
id:'table_wrapper',
baseCls:'x-plain',
renderTo: Ext.getBody(),
layout:'table',
layoutConfig: {columns:4},
defaults: {
frame:true,
width:200,
height: 200,
style: 'margin: 10px 0 0 10px'
},
items:[{
title:'Orders',
width: 810,
colspan: 4
},{
title:'Customer Information',
width: 400,
height: 400,
colspan: 2
},{
//title:'Shopping Cart',
frame: false,
border: false,
width: 400,
height: 400,
colspan: 2,
items: [ table_wrapper2 ]
}
]
});
replaceComponentContent(targetRegion, table_wrapper);
hideComponent(regionHelp);
</script>
4 Réponses :
Comme je l'ai dit dans la réponse à votre autre thread à l'aide de la Vbox et des mises en page HBOX pourraient vous être un peu plus facile si vous souhaitez effectuer un positionnement relatif. En outre, si vous voulez étirer des objets à votre fenêtre, mettez-le dans une fenêtre de fenêtre, qui vous utilise automatiquement une fenêtre entière.
Vous voudrez peut-être modifier la mise en page un peu (bordures, cadres), mais avec des mises en page Vbox et Habbox, ce serait quelque chose comme ceci: p>
new Ext.Viewport({ layout: 'vbox', layoutConfig: { align : 'stretch', pack : 'start' }, defaults: { style: 'margin: 10px 0 0 10px' }, items:[{ title:'Orders', height: 200 },{ layout: 'hbox', flex: 1, layoutConfig: { align : 'stretch', pack : 'start' }, items: [{ title:'Customer Information', flex: 1 },{ layout: 'vbox', flex: 1, layoutConfig: { align : 'stretch', pack : 'start' }, items: [{ title: 'Shopping cart', height: 200 },{ layout: 'hbox', flex: 1, layoutConfig: { align : 'stretch', pack : 'start' }, items: [{ title: 'Invoice address', flex: 1 },{ title: 'Delivery address', flex: 1 }] }] }] } ] });
Pensez à utiliser ColumnLayout code> à la place. Cela vous donne un choix entre les pixels et les pourcentages pour les largeurs. P>
au lieu de: Essayez ceci: p>
Essayez-le d'un exemple de violon: https://fiddle.sencha.com/#fiddle/2dm
Ext.create('Ext.panel.Panel', { title: 'Car Simple Tree', height: 200, //Fixed height for this panel renderTo: Ext.getBody(), layout: { type: 'table', columns: 2, tableAttrs: { style: { width: '100%' // To make the cell width 100% } } }, items: [{ xtype: 'panel', title: 'panel title', collapsible: true, titleCollapse: true, bodyStyle: { background: '#D9E5F3', borderColor: '#99BCE8', borderWidth: '1px' }, //scrollable: true, //autoScroll: true, layout: { pack: 'center', type: 'hbox' }, rowspan: 1, colspan: 2, width: '100%', items: [{ text: 'Save', xtype: 'button', padding: 5 }] }, { html: 'Cell C content', cellCls: 'highlight' }, { html: 'Cell D content' }] });