PDA

View Full Version : How do constrain the max size of a viewport



qbert65536
25 Apr 2012, 8:05 AM
I need to constrain the total width of the viewport and add some white space to the left and right of the viewport, how can I do this ?

friend
25 Apr 2012, 8:39 AM
Something like this should work:



<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Viewport with fixed width center region</title>
<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css">

<script type="text/javascript" src="extjs/ext-all-debug-w-comments.js"></script>
<script type="text/javascript">
Ext.onReady(function() {
Ext.create('Ext.container.Viewport', {
layout: {
type: 'hbox',
align: 'stretch'
},
items: [{
xtype: 'container',
flex: 1
},{
xtype: 'panel',
layout: 'fit',
title: 'Center Region',
width: 800
},{
xtype: 'container',
flex: 1
}]
});
});
</script>
</head>

<body>
</body>
</html>