If I run the code below in a browser I get an error display of my interface. The problem is the presence of two vertical scrollbars that are visible with both IE than with FF.
Below is an example of the code I'm using.
Ext.onReady(function() {
Ext.QuickTips.init();
var tree = new Ext.ux.tree.TreeGrid({
title: 'Core Team Projects',
enableDD: true,
defaultSortable: false,
enableSort: false,
autoScroll: true,
columns:[
{
header: 'Task',
dataIndex: 'task',
width: 230
},{
header: 'Duration',
width: 100,
dataIndex: 'duration',
align: 'center',
sortType: 'asFloat',
tpl: new Ext.XTemplate('{duration:this.formatHours}', {
formatHours: function(v) {
if(v < 1) {
return Math.round(v * 60) + ' mins';
} else if (Math.floor(v) !== v) {
var min = v - Math.floor(v);
return Math.floor(v) + 'h ' + Math.round(min * 60) + 'm';
} else {
return v + ' hour' + (v === 1 ? '' : 's');
}
}
})
},{
header: 'Assigned To',
width: 150,
dataIndex: 'user'
},{
header: 'Test',
width: 150,
dataIndex: '',
tpl: new Ext.XTemplate(
'test'
)
}],
dataUrl: '/QgenQueryBuilder/testtreegrid/treegrid-data.json.asp'
});
var mainQueryPanel = new Ext.Panel({
id:'mainQueryPanel',
region: 'center',
layout:'fit',
margins:'0 0 0 0',
title:'Workspace',
header:true,
border:true,
draggable:false,
collapsible:false,
collapsed:false,
autoScroll:true,
hidden: false,
items:[tree]
});
var mainDataPanel = new Ext.Panel({
id:'mainDataPanel',
activeItem: 0,
region: 'south',
layout: 'card',
title:'Risultato interrogazione',
margins:'0 0 0 0',
height:290,
header:true,
border:true,
draggable:false,
collapsible:true,
collapsed:false,
autoScroll:false,
hidden: false,
split:true
});
var mainCenterPanel = new Ext.Panel({
xtype: 'panel',
id: 'mainCenterPanel',
layout: 'border',
region: 'center',
autoScroll: false,
margins: '2 0 5 5',
items:[mainQueryPanel,mainDataPanel]
});
var mainViewport =new Ext.Viewport({
layout: 'border',
//title: 'Ext Layout Browser',
items: [{
id: 'content-panel',
region: 'center', // this is what makes this panel into a region within the containing layout
layout: 'card',
margins: '2 5 5 0',
activeItem: 0,
border: false,
disabled: false,
items: [mainCenterPanel]
}]
});
});
I have no idea how to fix this error.
Any help is appreciated.
Thank you all.
Even though its not a descriptive and thoroughly explaining answer, I haven't set the autoScroll (autoScroll: true) on the TreeGrid I use. But it seems like I still get the scrollbars if the contents exceeds the visible area of its container.
Try setting all the autoScroll: true to autoScroll: false except new Ext.ux.tree.TreeGrid({
I've had this same problem with this component, it roots from treepanel not working well with border layouts. I suggest putting the tree in a wrapper panel, and have it stretch layout on wraper panel. Then set the wrapper panel in your items.
Related
I have a tab panel.I open a tab and a grid is shown. Then i double click a row and a window is opened. In this window i have a panel and in this panel i have 4 textfields.
Then i close window, and double click another row, window is opened and fields that in panel shown correctly like below.
label label label label
|_______| |______| |______| |______|
When i close tab and opened it again and click row to open window, window is opened but in my panel's items shown three times. I mean it looks like below :
label label label label
label label label label
label label label label
And every click rows it is increasing...
My window is ;
var win = new Ext.Window({
width: 680,
height: 250,
title: 'Details',
layout: 'border',
modal: true,
closeAction:'hide',
items: [top,grid]
});
and my panel (name is top)
var top = new Ext.FormPanel({
labelAlign: 'top',
region : 'north',
frame:true,
bodyStyle:'padding:5px 5px 0',
width: 680,
height:75,
items: [{
layout:'column',
items:[{
columnWidth:.25,
layout: 'form',
items: [{
xtype:'textfield',
id : 'date',
fieldLabel: '<font color="red" style="margin-left: 25px" ><b>date</b></font>',
labelSeparator: '',
style: 'text-align: center;',
width:120
}]
},{
columnWidth:.25,
layout: 'form',
items: [{
id : 'xxx',
xtype:'textfield',
fieldLabel: '<font color="red"style="margin-left: 25px" ><b>xxxx</b></font>',
labelSeparator: '',
style: 'text-align: center;',
width:120
}]
},{
columnWidth:.25,
layout: 'form',
items: [{
id : 'cost',
xtype:'textfield',
fieldLabel: '<font color="red"style="margin-left: 4px" ><b>cost</b></font>',
labelSeparator: '',
style: 'text-align: right;',
width:120
}]
},{
columnWidth:.25,
layout: 'form',
items: [{
id : 'price',
xtype:'textfield',
fieldLabel: '<font color="red"style="margin-left: 15px" ><b>price</b></font>',
labelSeparator: '',
style: 'text-align: right;',
width:120
}]
}]
}]
});
I try to change window's closeAction config 'hide' to 'destroy', but this time i can not open window second time if i don't close the tab.
How can i fix this problem.
Thank you very much.
var grid = new Ext.grid.GridPanel({
stripeRows: true,
frame: false,
border:false,
autoScroll: true,
loadMask: {msg : 'loading...'},
trackMouseOver:false,
store: store,
bbar: paging,
region:'center',
cm: cm,
sm: sm,
viewConfig: {enableRowBody:true,emptyText: 'empty...'},
listeners: {
celldblclick: function(){
showDetail();
}
}
});
and showDetail function is ;
var showDetail = function(){
store.baseParams = {
Id : sm.getSelected().data['ID']
};
store.load();
win.show();
var d =sm.getSelected().data['date'];
Ext.getCmp("xxx").setValue(sm.getSelected().data['xxx']);
Ext.getCmp("date").setValue(d.getDate() + '/' + (d.getMonth()+1) + '/' + d.getFullYear());
Ext.getCmp("cost").setValue((sm.getSelected().data['cost']));
Ext.getCmp("price").setValue((sm.getSelected().data['price']));
};
You need to create the window on every call and destroy when close
function createWindow(){
return new Ext.Window({
width: 680,
height: 250,
title: 'Details',
layout: 'border',
modal: true,
closeAction:'destroy',
items: [top,grid]
});
}
And then call the createWindow
var showDetail = function(){
store.baseParams = {
Id : sm.getSelected().data['ID']
};
store.load();
var win = createWindow();
win.show();
var d =sm.getSelected().data['date'];
Ext.getCmp("xxx").setValue(sm.getSelected().data['xxx']);
Ext.getCmp("date").setValue(d.getDate() + '/' + (d.getMonth()+1) + '/' + d.getFullYear());
Ext.getCmp("cost").setValue((sm.getSelected().data['cost']));
Ext.getCmp("price").setValue((sm.getSelected().data['price']));
};
My viewport fits all browser but I want this to fit only 80% of browser's width. How can I do it?
This is my code below maybe you want to see it.
This is my viewport code:
var view = new Ext.Viewport({
layout: 'border',
autoScroll: true,
border: true,
items:[header,menuBar
,{
region: 'south',
collapsible: false,
padding: '25 25 25 25' ,
html:'Sanguis Team 2012',
border: true,
height: 100
},content
]
});
Ext.onReady(function(){
//var topHTML = '<img style="margin-left: 5px" src="Google_maps_logo.png" alt="logo" height="60" width="380">';
//Ext.BLANK_IMAGE_URL = 'extjs/resources/images/default/s.gif';
Ext.QuickTips.init();
var item1 = new Ext.Panel({
title: 'Kan Bağışı',
collapsible : true,
collapsed: true,
padding: '5 5 5 5' ,
html: 'Nerede Kan verebilirim?<br/>' +
'Kan Bağışlama Süreci'
});
var item2 = new Ext.Panel({
title: 'Kan Hakkında',
collapsed: true,
padding: '5 5 5 5' ,
collapsible : true,
html: 'Kanın Yapısı ve Görevleri Nelerdir?<br/>' +
'Kan Bağışlarım Nerede kullanılıyor<br/>'+
'Kan Grupları Hakkında Bilgiler<br/>'+
'Kana Yapılan Testler<br/>'+
'Dünya ve Türkiyede Kan Bağışı'
});
var item3 = new Ext.Panel({
title: '<a style="color: #FFFFFF;" href="#">Sıkça Sorulan Sorular</a>',
collapsible :false,
titleCollapse: false
});
var item4 = new Ext.Panel({
title: 'Site Kullanımı',
collapsed: true,
padding: '5 5 5 5' ,
collapsible : true,
html: 'Site Nasıl Çalışmaktadır<br/>' +
'Kan İsteğinde Nasıl Bulunabilirim?<br/>'
});
var item5 = new Ext.Panel({
padding: '5 5 5 5' ,
title: 'Kullanıcı Girişi',
bodyStyle : 'padding : 10px',
layout : 'form',
items: [
{
xtype: 'field',
fieldLabel: 'E-posta',
width: 100
},{
xtype: 'field',
fieldLabel: 'Şifre',
inputType:'password',
width: 100
},
{
xtype: 'button',
text: 'Giriş',
style: {
marginLeft: '170px'
},
align: 'right',
handler : function(btn){
Ext.MessageBox.alert('','kontrol yapılacak!!');
}
},
{
border : false,
html:'Şifremi Unuttum'
}
]
});
var item6 =new Ext.Panel({
border: false,
html: '<img src="../images/kaydol.jpg" />'
});
var menuBar = new Ext.Panel({
//layout: 'accordion',
autoScroll: true,
defaults: {autoScroll: true},
region: 'west',
width: 310,
defaults: {
hideCollapseTool : false,
//border: true
},
layoutConfig: {
// titleCollapse: false,
animate: true,
// activeOnTop: true,
autoScroll: true
},
margins:'5 0 5 5',
split:false,
items: [item1, item2, item4, item3, item5,item6]
});
var content = new Ext.Panel({
region: 'center',
autoScroll: true,
margins:'5 5 5 0',
layoutConfig : {
align : 'stretch'
},
html:'Ajax content will come here'
});
var header=new Ext.Panel({
renderTo: document.body,
layout: 'fit',
region: 'north',
html: '<p align="center"><img src="../images/banner.jpg" align="middle"/></p>',
height:150,
tbar: [
{
text: '<b>Ana Sayfa</b>',
iconCls: 'bmenu',
handler: function(){ alert('blah'); }
},
{
text: '<b>Hakkımızda</b>',
iconCls: 'bmenu',
handler: function(){ alert('blah'); }
},
{
text: '<b>Duyurular</b>',
iconCls: 'bmenu',
handler: function(){
}
},
{
text: '<b>İletişim</b>',
iconCls: 'bmenu', // <-- icon
handler: function(){ alert('blah'); }
}]
});
var view = new Ext.Viewport({
layout: 'border',
autoScroll: true,
border: true,
items:[header,menuBar
,{
region: 'south',
collapsible: false,
padding: '25 25 25 25' ,
html:'<br/><br/><p align="center"><b>Sanguis Team 2012</b></p>',
border: true,
height: 100
},content
]
});
/*var templates = new Ext.Window({
width:900,
height:700,
id:'Templates',
resizable:false,
//layout:'border',
//border:true,
closable:false,
title:'Plantillas',
items:view
});
templates.show();*/
// view.render('anasayfa');
});
There is no maxwidth property on viewport, as viewport is always the size of the window.
This works:
use a viewport, set its layout to anchor
add a container to viewport
set its anchor property to '80% 100%'
put whatever you want inside the container. you can give the container border layout if you want
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 have a panel containing two children panels.the parent panel uses "border" layout, while two children panels use "form" and "column" layouts respectively. now How can I make these two children panels resize accordingly when window resizes, i.e., make sure the size ratio of these two panels is constant.
thanks!
my codes are as follows:
itemRts = {
xtype: 'panel',
title: 'Route',
region: 'north',
autoHeight: true,
layout: 'form',
width: 294,
bodyStyle: 'padding:10px 12px 10px',
id: 'ROUTE_PANEL',
el: 'Route_Setup',
items: [
{
xtype: 'button',
text: 'Go',
anchor: '0',
id: 'GO_BTN'
}]
};
itemEvts = {
xtype: 'panel',
title: 'Events',
region: 'center',
layout: 'column',
tpl: 'Please put events here.',
//bodyStyle: 'padding:10px 12px 10px',
border: false,
hideBorders: true,
id: 'EVENT_PANEL',
el: 'Event_Legend',
autoScroll: true
};
newView = new Ext.Viewport({
layout: "border",
items: [
{
xtype: 'panel',
margins: '10 0 10 10',
region: 'center',
width: 200,
layout: 'border',
split: true,
boxMaxWidth: 280,
minWidth: 280,
id: 'RTS_EVTS_REGION',
collapseMode: 'mini',
items: [
itemRts,
itemEvts]
}]
});
how to modify above codes to make it work as what I want?
thanks again!
You can set a resize event for container panel and call "dolayout" method of their children in case of resize :
newView = new Ext.Viewport({
layout: "border",
items: [
{
xtype: 'panel',
margins: '10 0 10 10',
region: 'center',
width: 200,
layout: 'border',
split: true,
boxMaxWidth: 280,
minWidth: 280,
id: 'RTS_EVTS_REGION',
collapseMode: 'mini',
items: [itemRts, itemEvts],
listeners: {
'resize': function () {
itemRts.doLayout();
itemEvts.doLayout();
}
}
}]
});
for your main container, i suggest hbox and/or vbox layouts. those layouts are what you are looking for. here a sample:
var testPanel = new Ext.Viewport( {
id : 'vp_test',
layout : 'hbox',
align : 'stretch',
items : [
{
id : 'pnl_child_1',
title : 'Test 1',
flex : 2
},
{
id : 'pnl_child_2',
title : 'Test 2',
flex : 3,
layout : 'vbox',
align : 'stretch',
items : [
{
id : 'pnl_child_3',
title : 'Test 3',
flex : 1
},
{
id : 'pnl_child_4',
title : 'Test 4',
flex : 1
}
]
},
]
} );
you can refer to documentation, viewport, hbox, vbox
itemRts = {
xtype: 'panel',
title: 'Route',
// region: 'north', <<< we don't need this anymore
flex: 1, // this means that this container has 1 flexible share
// autoHeight: true, <<< this will ruin all layout
layout: 'form',
// width: 294, <<< we don't need this anymore
bodyStyle: 'padding:10px 12px 10px',
id: 'ROUTE_PANEL',
el:'Route_Setup',
items: [
{
xtype:'button',
text:'Go',
anchor:'0',
id:'GO_BTN'
}
]
};
itemEvts = {
xtype: 'panel',
title: 'Events',
// region: 'center', <<< we don't need this anymore
flex: 1, // this means that this container has 1 flexible share
layout: 'column',
tpl: 'Please put events here.', // <<<< if you're not going to use xTemplates you should use html property instead
//bodyStyle: 'padding:10px 12px 10px',
border: false,
hideBorders: true,
id: 'EVENT_PANEL',
el : 'Event_Legend',
autoScroll: true
};
newView = new Ext.Viewport({
//// if you have only one child component you can use fit layout for viewport.
//// and consider removing that only child. use viewport as main container.
layout : "border",
items: [
{
xtype: 'panel',
margins: '10 0 10 10',
region: 'center',
// width: 200, <<<< width has no effect on center region
/// we'll use hbox with align stretch
layout: 'hbox',
align: 'stretch',
// split: true, <<<< split has no effect on center region
// boxMaxWidth: 280, <<<< no effect
// minWidth: 280, <<<< no effect
id: 'RTS_EVTS_REGION',
// collapseMode: 'mini', <<<< collapse properties has no effect on center region
items: [
itemRts,
itemEvts
]
}
]
});
Below is a javascript variable that I'm using to load into the layout-browser...you will notice the listener section is commented out...when I uncomment this section the layout-browser and the tree do not show up. When I comment out the listener section, the layout-browser and the tree work fine with the exception of the listener populating the pool-details-panel.
Any ideas why the listener is blowing the render of the layout-browser and tree up?
var PoolStackTree = {
id: 'PoolStackTree-panel',
title: 'Pool List',
layout: 'border',
width: 500,
height: 500,
items: [{
xtype: 'treepanel',
id: 'pooltree-panel',
region: 'center',
margins: '2 2 0 2',
singleExpand: true,
animate: true,
useArrows: true,
autoScroll: true,
rootVisible: false,
root: new Ext.tree.AsyncTreeNode(),
loader: new Ext.app.PoolLoader({ dataUrl: 'calmonpool_views_xml.cgi' })
/*
listeners { 'render': function(tp) {
tp.getSelectionModel().on('selectionchange', function(tree-pool, node-pool) {
var el = Ext.getCmp('pool-details-panel').body;
if(node-pool && node-pool.leaf) {
tpl.overwrite(el, node-pool.attributes);
} else {
el.update(detailsText);
}
})
}}
*/
},{
id: 'pool-details-panel',
title: 'Pool Details',
region: 'south',
autoScroll: true,
collapsible: true,
split: true,
margins: '0 2 2 2',
cmargins: '2 2 2 2',
height: 220,
html: detailsText
}]
};
You're missing a comma before the "listeners" property name and a colon after the property name:
...,
listeners: { ...
Well just for starters you're missing a ":" after "listeners". That would certainly cause the Tree not to render.