I dont know what to do...
Without hbox the grid appears,
but with hbox not.
I added with & height and flex to each child element,
but it doesnt work...
Thanks in advance!
And here's the code:
Ext.onReady(function() {
var myStore = Ext.create('Ext.data.SimpleStore', {
fields: [ 'bMin', ], });
var myData = [ { "bMin": 10, } ];
myStore.loadData(myData);
var grid = new Ext.grid.GridPanel({
layout : { type : 'hbox', align : 'stretch', flex:2,
Height: 150,
Width: 300,
},
cls: 'custom-grid',
store: myStore,
columns: [
{text: "bMin", dataIndex: 'bMin', type: 'float',},
],
viewConfig: {
emptyText: 'No records',
forceFit : true,
},
renderTo: Ext.getBody(),
});
var myPanel = new Ext.Panel({
layout : {
type : 'hbox',
align : 'stretch',
},
title: 'Hello',
minHeight : 150,
minWidth: 300,
Height: 150,
Width: 300,
items: [
grid,
{xtype: 'button', width: 50, height: 50, flex: 1}
],
renderTo: Ext.getBody()
});
});
On the Grid you don't need a 'layout' config, also when using an HBox Height and Width is ignored on the child components so using flex is the way to go. I also added a 'pack' attribute to the hbox layout.
Try this:
Ext.onReady(function() {
var myStore = Ext.create('Ext.data.SimpleStore', {
fields: [ 'bMin', ], });
var myData = [ { "bMin": 10, } ];
myStore.loadData(myData);
var grid = new Ext.grid.GridPanel({
flex: 1,
cls: 'custom-grid',
store: myStore,
columns: [
{text: "bMin", dataIndex: 'bMin', type: 'float',},
],
viewConfig: {
emptyText: 'No records',
forceFit : true,
},
renderTo: Ext.getBody(),
});
var myPanel = new Ext.Panel({
layout : {
type : 'hbox',
align : 'stretch',
pack: 'start'
},
title: 'Hello',
minHeight : 150,
minWidth: 300,
Height: 150,
Width: 300,
items: [
grid,
{xtype: 'button', flex: 1, text: 'test'}
],
renderTo: Ext.getBody()
});
});
JSFiddle Example:
http://jsfiddle.net/vzURb/2/
I see a number of problems here...
height and width config properties should not be capitalized
The flex, height, and width properties should all be on the panel itself, NOT on the panel's layout
The flex attribute will be weighted, so using flex: 1 on your button and flex: 2 on your panel will almost certainly not be what you are looking to do
You have renderTo on the grid, which is supposed to be inside your panel, so it should not use this config
You have commas at the ends of property lists, this can lead to lots of problems
You have type on a column, which is not a valid config
You don't need the layout on the grid
I can't tell exactly what it is that you want to do, but having an hbox layout with a button as the second item will look quite strange. But, if that is what you are intending, this is probably more what you want:
var grid = new Ext.grid.GridPanel({
cls: 'custom-grid',
store: myStore,
columns: [
{text: "bMin", dataIndex: 'bMin'}
],
viewConfig: {
emptyText: 'No records',
forceFit : true
}
});
var myPanel = new Ext.Panel({
layout : {
type : 'hbox',
align : 'stretch'
},
title: 'Hello',
height: 150,
width: 300,
items: [
grid,
{xtype: 'button', width: 50, height: 50, flex: 1}
],
renderTo: Ext.getBody()
});
Related
I am trying to put a BorderLayout inside a VBoxLayout, and having this BorderLayout a 100% height.
I try:
Ext.create('Ext.container.Viewport', {
layout : 'fit',
items : [
Ext.create('Ext.panel.Panel', {
width: '100%',
layout: {
type: 'vbox',
align: 'stretch'
},
items: [
Ext.create('Ext.panel.Panel', {
flex: 0,
height: 200,
layout: 'border',
items: [
Ext.create('Ext.panel.Panel', {
title: 'toto',
region: 'center'
})
]
})
]
})
]
});
It works well, but if I replace height: 200 with height:'100%', I do not see anything.
What I am doing wrong?
Thanks for your help!
(ps: The VBoxLayout is a requirement, my application is much more complex that this example, and I cannot change the VBoxLayout).
I think you must change form flex:0 to flex:1
My problem is, even if I used "layout: 'fit'" in all my children items within a boarder layout, they just shrinks into a small box rather than fill the parent, as described in fit layout.
I want the EDS.view.selector.Container to fill the "navigation" section of my boarder layout.
(Code excerpt)
Ext.define('EDS.view.selector.Container', {
extend: 'Ext.panel.Panel',
alias : 'widget.selectorcontainer',
layout: 'fit',
initComponent: function(){
this.items = [
{
xtype: 'tabpanel',
defaults: {
bodyPadding: 10
},
layout: 'fit',
items:[
{
title: 'Organization',
id: 'selector-organization',
tag: 'div',
html: 'div here',
height: '100%',
}
]
}
],
this.callParent();
},
});
(Controller)
init: function(){
console.log('controller.init()');
new Ext.Viewport({
title: 'Data Analysis',
layout: 'border',
defaults: {
collapsible: true,
split: true,
bodyStyle: 'padding: 15px',
},
items: [{
title: 'Navigation',
region:'west',
margins: '5 0 0 0',
cmargins: '5 5 0 0',
width: 600,
minSize: 100,
maxSize: 250,
items: [
{
id: 'selector-container',
xtype: 'selectorcontainer',
layout: 'fit',
}
]
},{
title: 'Main Content',
collapsible: false,
region:'center',
margins: '5 0 0 0'
}]
});
}
You did not set up layout for wrapper containers in your border layout:
items: [{
title: 'Navigation',
region:'west',
layout: 'fit',
...
items: [
]
},{
title: 'Main Content',
collapsible: false,
region:'center',
layout: 'fit',
...
}]
Remember: In ExtJS any plain JS object that goes into items property of a container will be converted into some type of Ext component with xtype defined by defaultType property of that container. In most cases it will be panel.
i have a treegrid and i need to make it as editorGrid.
My treegrid is
var tree = new Ext.ux.tree.TreeGrid({
title: 'Core Team Projects',
height: 500,
renderTo: Ext.getBody(),
autoLoad:false,
plugins: [editor],
columns:[
{
header: 'Name',
dataIndex: 'name',
width: 230
},{
header: 'length',
width: 150,
sortType: 'asFloat',
dataIndex: 'length'
},{
header: 'size',
width: 150,
sortType: 'asFloat',
dataIndex: 'size'
},{
header: 'dataType',
width: 150,
dataIndex: 'dataType'
},{
header: 'extName',
width: 150,
dataIndex: 'extName'
},{
header: 'overlay',
width: 150,
dataIndex: 'overlay'
},{
header: 'qualified',
width: 150,
dataIndex: 'qualified'
}],
loader: myTreeLoader
});
and the editor which i used is
var editor = new Ext.ux.grid.RowEditor({
saveText: 'Save',
errorSummary : true,
monitorValid: true,
clicksToEdit: 1,
// floating: true,
shadow: true,
layout: 'hbox',
cls: 'x-small-editor',
buttonAlign: 'center',
baseCls: 'x-row-editor',
elements: 'header,footer,body',
frameWidth: 5,
buttonPad: 3,
focusDelay: 250,
cancelText: 'Cancel',
//commitChangesText: 'You need to Update or Cancel your changes',
// errorText: 'Errors',
defaults: {
normalWidth: true
}
});
it gives an error "Object doesn't support this property or method"
Could Someone pls give a solution
The "Ext.ux.tree.TreeGrid" in Extjs v3.x.x is not a real "grid" (based on treepanel + treeloader...), that's why you can't use "Ext.ux.grid.RowEditor" (because roweditor need a grid + store...).
2 Solutions:
Switch to Extjs v4.x.x and you can use "Ext.grid.plugin.CellEditing":
ExtJs TreeGrid with editor column. Exists?
Override createNode (in "Ext.ux.tree.TreeGridLoader") or modify the "Ext.ux.tree.TreeGridNodeUI":
http://www.sencha.com/forum/showthread.php?118393-treegrid-checkbox-extension
Checkbox Column in ExtJS TreeGrid
(Examples to put checkboxes you can modify to put others components...)
Good luck...
I want to use viewport and use accordion layout for my menu items.
but I want my accordion layout not fill and use all spaces for each item
I use layoutConfig like examples but it dosn't work and the accordion fill all spaces and stretch vertically :
this.view = new Ext.Viewport({
layout: 'border',
renderTo : document.body,
items: [{
xtype: 'box',
region: 'north',
height: 60,
contentEl: 'framework_north'
},{
region: 'east',
title: 'امکانات سیستم',
split: true,
collapsible: true,
width: 200,
minSize: 200,
maxSize: 200,
layout:'accordion',
layoutConfig: {
fill : false,
collapseFirst : true,
hideCollapseTool : true
},
tbar : [
{
contentEl : "framework_clock",
autoWidth : true,
xtype: 'box',
height : 80
}],
items: this.menuItems
},
this.centerPanel]
});
what is my fault :'(
wrap your accordion in a vbox container and set the height to whatever you want.
I have a panel which is fullscreen;
PortalDashboard.views.Dashboardcard = Ext.extend(Ext.Panel, {
fullscreen: true,
title: 'Dashboard',
html: '',
cls: 'card5',
iconCls: 'team',
layout: Ext.Viewport.orientation == 'landscape' ? {
type: 'hbox',
pack: 'center',
align: 'stretch'
} : {
type: 'vbox',
align: 'stretch',
pack: 'center'
},
monitorOrientation: true,
listeners: {
orientationchange : this.onOrientationChange,
},
styleHtmlContent: false,
initComponent: function () {
Ext.apply(this, {
items: [
{
xtype: 'dashboardbox',
items: [rep1, rep2, rep3]
}, {
xtype: 'dashboardbox',
items: [rep4, rep5, rep6]
}]
});
PortalDashboard.views.Dashboardcard.superclass.initComponent.apply(this, arguments);
}
})
So the panel has a hbox layout with 2 child panels. The child panels actually take up the full amount of horizontal space, but not vertically.
I can set the min-height in the css, which gets respected on in chrome and safari on my pc... but the ipad ignores it.
The child panels are defined as;
PortalDashboard.views.DashboxBox = Ext.extend(Ext.Panel, {
cls: 'dashbox',
monitorOrientation: true,
listeners: {
orientationchange : this.onOrientationChange,
},
layout: Ext.Viewport.orientation == 'landscape' ? {
type: 'vbox',
align: 'stretch',
pack: 'center'
} : {
type: 'hbox',
align: 'stretch',
pack: 'center'
},
defaults: {
flex: 1
}
});
Ext.reg('dashboardbox', PortalDashboard.views.DashboxBox);
I've had this before with a TabPanel parent of some sub panels. Try layout: 'fit' in your parent panel. (Although I'm not sure if adding it to your current list of layout options will work or if it needs to be set by itself.)