I got a viewport and within the center region a window.
When I try to move the window to the top of the center region, the window doesn't stay on the top.
I note that the window is positioned at the top + the height of the north region.
This is the code:
Ext.onReady(function(){
Ext.create('Ext.container.Viewport', {
layout: 'border',
forceFit: true,
hideMode: 'offsets',
items: [
{
region:'north',
id:'btns',
height: 150,
layout:
{
type: 'hbox',
padding:'5',
align:'stretch'
},
items:[]
}, {
region: 'east',
autoScroll: true,
border: false,
items:[{
xtype: 'container',
id: 'page_gauche1',
width: 500,
height: 920,
border: false
}]
}, {
region: 'center',
id: 'center',
autoScroll: true,
border: true,
items: {
xtype: 'container',
id: 'page_gauche4',
width: 1400,
height: 920,
border: false,
hidden: true
}
}]
});
Ext.create('Ext.Window', {
layout: 'fit',
border: false,
header: true,
draggable: true,
resizable: true,
autoShow: true,
constrain: true,
renderTo: 'center',
width: 300,
height: 200
});
});
A window is a floating component you should not use renderTo here! In addition you should never set the id on your own if it can be avoided!
Do you this?
Fiddle
{
region: 'center',
id: 'center',
autoScroll: true,
border: true,
items: {
xtype: 'container',
id: 'page_gauche4',
width: 1400,
height: 920,
border: false,
hidden: true
},
listeners: {
boxready: function(self) {
Ext.create('Ext.Window', {
layout: 'fit',
border: false,
autoShow: true,
constrain: true,
constrainTo: self.getEl(),
width: 300,
height: 200
});
}
}
}
Related
I have two panels inside a container (layout: fit) and both panels need to be collapsible horizontal.
To realize this I need to have three panels (2 panels with region: west and one panel region center) like this:
defaults: {
collapsible: true,
split: true,
margin: 1,
padding: 1,
height: '100%'
},
items: [{
title: 'west 1',
floatable: false,
flex: 100,
region: 'west'
}, {
hidden: true,
collapsed: true,
region: 'center',
flex: 1,
split: false
}, {
title: 'west 2',
floatable: false,
flex: 100,
floatable: false,
region: 'west',
split: false
}]
It works but the extra panel is very uggly!. Does anyone have a better sollution?
regards,
Arno
Use it like below code snippet:
Ext.create('Ext.panel.Panel', {
width: 500,
height: 300,
title: 'Container',
layout: 'hbox',
defaults: {
collapsible: true,
collapseDirection: 'left',
margin: 1,
height: '100%'
},
items: [{
title: 'west 1',
width: 100
}, {
title: 'west 2',
floatable: false,
flex: 1,
split: false
}],
renderTo: Ext.getBody()
});
Working Example
Hope this will help/guide you.
I am using ExtJS HTMLEditor and set the properties as follows-
{ xtype: "htmleditor", width: 500, height: 250}
While entering the text, after reaching the specified height, the toolbar gets disappeared.
I tried removing the height and setting autoHeight: true but in both cases the HTML editor does not fit to the window (HTMLEditor is inside Ext.form.FormPanel).
Anyone having idea to solve it.
This is my code
Ext.onReady(function() {
Ext.create('Ext.window.Window', {
title: 'This is Title',
resizable: false,
modal: true,
height: 300,
width: 500,
layout: 'fit',
closeAction: 'hide',
items: [
new Ext.form.FormPanel({
border: false,
autoHeight: true,
items: [
{ allowBlank: false, xtype:
"htmleditor", height: 250, width: 600, anchor:'100%'}
]
})
],
buttons: [
{text: 'Ok' },
{text: 'Cancel'}
]
}).show();
});
I have solved the problem- Added layout: 'fit' to Formpanel
Ext.onReady(function() {
Ext.create('Ext.window.Window', {
title: 'This is Title',
resizable: false,
modal: true,
height: 300,
width: 500,
layout: 'fit',
closeAction: 'hide',
items: [
new Ext.form.FormPanel({
border: false,
layout: 'fit', // This fixed the issue
items: [
{ allowBlank: false,
xtype: "htmleditor",
height: 250,
width: 600
}
]
})
],
buttons: [
{text: 'Ok' },
{text: 'Cancel'}
]
}).show();
});
I'm about to go crazy.
I have my panels configured as follows:
accordion = new Ext.Panel({
id: 'accordionPanel',
title: 'Options',
region: 'center',
animCollapse: true,
border: false,
minWidth: 150,
maxWidth: 400,
autoScroll: true,
autoHeight: true,
layout: 'accordion',
layoutConfig: {
animate: true
}
});
var panelOne = new Ext.Panel({
region: 'center',
layout: 'border',
defaults: {
collapsible: true,
split: true
},
items: [{
title: 'Navigation',
region: 'west',
margins: '5 0 0 0',
animCollapse: true,
autoScroll: true,
autoHeight: true,
width: 200,
minWidth: 150,
maxWidth: 400,
layout: 'border',
layoutConfig: {
animate: true
},
items: [
Ext.Panel({
region: 'north',
border: false,
collapsible: false,
height: 65,
align: 'center',
html: myHtmlSource
}),
accordion
]
}, {
title: 'Main Content',
region: 'center',
layout: 'absolute',
listeners: {
'close': Ext.bind(this.onPortletClose, this)
},
items: [someWindows],
collapsible: false,
margins: '5 0 0 0'
}]
});
viewport = new Ext.Viewport({
layout: 'border',
id: 'viewport',
items: [panelOne]
})
accordionPanel has a bunch of grids like this one inside of it:
var myGrid = new Ext.grid.Panel({
id: 'myGrid',
layout: 'anchor',
border: false,
title: 'My Grid',
width: 412,
store: store,
heigth: 300,
frame: false,
columns: [myColumns],
.....
});
Each of those grids is a separate accordion tab.
Now my problem is that those grids never display scrolls.
Just to be clear, this looks like the border layout that is displayed here.
Except that the navigation panel has an accordion inside of it with multiple grids in it.
Can't think of anything else to try.
Anyone?
I wan to apply horizontal scrollbar in my panel(ExtJS)
my code is...
var reportPanel = new Wtf.Panel({
border: false,
title: "Chart View",
autoScroll: true,
iconCls: "pwndCRM piechartIcon",
bodyStyle: 'background:white',
layout: 'border',
tbar: [this.pieChartButton, this.barChartButton],
closable: true,
items: [new Wtf.Panel({
id: mainpanid + "center_panel",
autoScroll: true,
//columnWidth:.47,
layout: "fit",
border: true,
region: "center",
width: '50%',
collapsible: true
})
, new Wtf.Panel({
id: mainpanid + "east_panel",
autoScroll: true,
border: true,
layout: "fit",
//columnWidth:.48,
region: "east",
width: '50%',
collapsible: true
})
]
});
It is not working can anybody tell what is wrong with code...?
I need align the formpanels to the center, so I used the vbox layout, and after I used it the autoscroll did not work as before, the code is as below:
Usr.VWPanel = Ext.extend(Ext.Panel, {
id: null,
rid: null,
closable: true,
autoScroll: true,
buttonAlign: 'center',
layout: {
type:'vbox',
padding:'5',
pack:'center',
align:'center'
},
initComponent: function () {
Ext.apply(this, {
items: [
{
xtype: 'spacer',
height: 16
},
{
xtype: 'usr.usrform',
itemId: 'usr.vwpain.usrformt',
width: 600,
height: 500
},
{
xtype:'spacer',
height: 16
},
{
xtype: 'usr.loginform',
itemId: 'usr.vwpain.loginform',
width: 600
},
{
xtype: 'spacer',
height: 16
},
{
xtype: 'usr.subsform',
itemId: 'usr.vwpain.subsform',
width: 600
}],
...
plz advise.
the vbox layout will never show the scroller.
{
xtype: 'window',
title: 'My Window',
width: 500,
height: 500,
layout: 'vbox',
layoutConfig: {
pack: 'center',
align: 'center'
},
items: [
{
xtype: 'panel',
title: 'My Panel',
anchor: '80% 100%',
height: 300,
width: 300,
autoScroll: true,
items: [
{
xtype: 'panel',
html: 'this isform1',
height: 100
},
{
xtype: 'panel',
html: 'this isform1',
height: 100
},
{
xtype: 'panel',
html: 'this isform1',
height: 100
}
]
}
]
}
in your css you can set your My Panel margins to {0 auto} which will center the My Panel inside the window. This means you don't need a special layout config for your window.
I have added a listener on resize event to get the vertical scroll as for Vbox we have to provide height to get scroll but when window size get change scroller height remain constant.
Ext.define('DataConfigurations', {
extend: 'Ext.form.Panel',
bodyStyle: 'padding:5px 5px;',
listeners: {
resize: {
fn: function(el) {
this.setHeight(this.up('window').getHeight()-150); // 150 is extra for my panel coz of headers so have minus it.
console.log("new height = " + this.up('window').getHeight()-150);
}
}
},
title: "Update Data Configurations",
Hopes this help.