I am not able to get border for combobox.
xtype: "toolbar",
overflowHandler: "scroller",
dock: "top",
items: [{
xtype: "combo",
itemId: "combo1",
width: 80,
labelWidth: 50,
fieldLabel: "Filename",
store: filenames,
queryMode: "local",
displayField: "text",
fieldStyle: {
borderRadius: "3px"
}
}]
border is not displaying for combobox.
You appear to be missing the border config property from your component. That could be one of the reasons of your problem, especially as your component seems to be embedded in a toolbar.
From Sencha's documentation:
Specifies the border size for this component. The border can be a single numeric value to apply to all sides or it can be a CSS style specification for each style, for example: '10 5 3 10' (top, right, bottom, left).
For components that have no border by default, setting this won't make the border appear by itself. You also need to specify border color and style:
border: 5,
style: {
borderColor: 'red',
borderStyle: 'solid'
}
Note that setting borderRadius as you did does not imply that there will automatically be a border. It only states that "should there be a border, it will have that radius in its corners".
Most likely, all you need is to add the following to your combo configuration:
border: 1
Modifying Sencha's fiddle provided in the documentation to have a toolbar, the border is present whether you manually set the border property or not.
The following code - run within the sencha documentation itself - demostrates a combobox within a toolbar, with its border.
// The data store containing the list of states
var states = Ext.create('Ext.data.Store', {
fields: ['abbr', 'name'],
data : [
{"abbr":"AL", "name":"Alabama"},
{"abbr":"AK", "name":"Alaska"},
{"abbr":"AZ", "name":"Arizona"}
]
});
// Create the combo box, attached to the states data store
var cmb = Ext.create('Ext.form.ComboBox', {
fieldLabel: 'Choose State',
border: 5,
style: {
borderColor: 'red',
borderStyle: 'solid'
},
store: states,
queryMode: 'local',
displayField: 'name',
valueField: 'abbr'
});
Ext.create({
xtype: "toolbar",
overflowHandler: "scroller",
dock: "top",
renderTo: Ext.getBody(),
items: [
cmb
]
});
Problems related to border and the like are often caused by the CSS of your team not being imported or the related js file not being loaded, in contexts where ExtJS has not been "prepared" built using sencha build but instead manually imported.
Alternatively, it's a CSS problem. In that case you'll have to use The Developer Tools of your browser of choice (F12 key, usually) and inspect the border-related properties for your component.
Related
In ExtJS 5, I wanna remove border of textfield and make it like this:
Of course it can be done by two labels, but it's not very clean. I tried following two ways on ExtJS5 official website, but it doesn't work:
Ext.create('Ext.form.Panel', {
title: 'Contact Info',
width: 300,
bodyPadding: 10,
renderTo: Ext.getBody(),
items: [{
// here 1
xtype: 'textfield',
name: 'name',
fieldLabel: 'Name',
border: 0, // set border = 0 or false
hideBorders: true
}, {
// here 2
xtype: 'textfield',
name: 'email',
fieldLabel: 'Email Address',
style: 'border: none;background-image:none;' // set style border none
}]
});
Results:
Anybody who have any idea? Thanks.
If you absolutely need to use the textfield xtype, you can remove the border by clearing the inputWrapCls config. Some Ext JS themes add a border to the div wrapping the input element (and any trigger buttons), so you may have to clear the triggerWrapCls config as well.
You will likely also want to modify the fieldStyle config to remove the input element's background:
{
xtype: 'textfield',
name: 'name',
fieldLabel: 'Name',
// remove default styling for element wrapping the input element
inputWrapCls: '',
// remove default styling for div wrapping the input element and trigger button(s)
triggerWrapCls: '',
// remove the input element's background
fieldStyle: 'background:none'
}
Try with displayfiled in place of textfiled
for reference go through the link. http://www.objis.com/formationextjs/lib/extjs-4.0.0/docs/api/Ext.form.field.Display.html
I have a layout of type 'border' and in the 'center' panel I have a MapPanel.
I want to display a modeless popup with the code below.
It works fine, I can drag and resize.
But on resizing, if I drag with mouse outside the popup area (and inside MapPanel area) then I loose control of this action (the dotted line representing popup border disappear). But if I insist in dragging moving outside MapPanel area to 'west' or 'south' panel, then I will get again control of this action (dotted lines appear). I think that MapPanel will get mouse control when it is hovering on it. This behavior let resizing popup still possible but a bit tedious.
If I disable MapPanel on showing popup, resize works well, but that's not what I want. I want to display a modeless popup.
Any idea on any workaround?...
var mapPanel = Ext.ComponentQuery.query('viewMapPanel')[0];
Ext.create('GeoExt.window.Popup', {
map: mapPanel.map,
title: 'test',
frame: true,
border: false,
resizable: true,
draggable: true,
closable: true,
height: 400,
width: 200,
shadow: true,
shadowOffset: 20,
//modal:true
}).show();
Never used GeoExt. But I have used: http://code.betancourt.us/ext-map/ with the xtype: 'gmappanel' with success. You can just use a regular Ext.window and do layout: 'fit', items: {map} and it doesn't have these kinds of issues.
I think you could probably do the same thing instead of using GeoExt just use Ext.create('Ext.window.Window', { and have it pop up a regular window you can choose a layout for and then put your mapPanel in items.
var map = Ext.create('Ext.window.Window', {
title: 'I love Maps',
collapsible: true,
animCollapse: true,
maximizable: true,
width: 950,
height: 600,
minWidth: 200,
minHeight: 200,
layout: 'fit',
items: [{mapPanel}],
dockedItems: [{
xtype: 'toolbar',
dock: 'bottom',
ui: 'footer',
layout: {
pack: 'center'
},
items: [{
minWidth: 80,
text: 'Close',
xtype: 'button'
}]
}]
});
map.show();
I assume you handed over a custom OpenLayers map to the GeoExt map panel instead of using the default. Set property "fallThrough" of that map to true, to allow bubbling up events.
var map = new OpenLayers.Map({
fallThrough: true
});
In the ExtJS 3, how to set a grid to auto width? I have tried the codes below, it doesn't work.
Thanks
var exceptionGrid = new Ext.grid.GridPanel({
store: exceptionStore,
loadMask: true,
frame: true,
// defaultWidth: 450,
//height: 560,
autoHeight: true,
autoWidth: true,
colModel: new Ext.grid.ColumnModel({
defaults: {
width: 120,
sortable: true
},
columns: [{
header: 'COL1',
dataIndex: 'COL1'
}, {
header: 'COL2',
dataIndex: 'COL2'
}, {
header: 'COL3',
dataIndex: 'COL3'
}, .....]
}),
viewConfig: {
forceFit: false
}
});
From extjs 3 docs:
GridPanel
Notes:
- Although this class inherits many configuration options from base
classes, some of them (such as autoScroll, autoWidth, layout, items,
etc) are not used by this class, and will have no effect.
- A grid requires a width in which to scroll its columns, and a height
in which to scroll its rows. These dimensions can either be set
explicitly through the height and width configuration options or
implicitly set by using the grid as a child item of a Container which
will have a layout manager provide the sizing of its child items (for
example the Container of the Grid may specify layout:'fit').
Grid's width by default takes containers width of course if it was not specified.
Ext.grid.GridPanel#autoExpandColumn will help to expand one column in the grid taking the resting horizontal space. Also will be helpsul to look at Ext.grid.GridView's forceFit and autoFill adjusting widths of columns.
There are Multiple ways to do it based on your design
1.Try width: '100%' and autoHeight:true although autoHeight:true \ height: '100%' creates problem sometime, but width works fine always.
2.Use below code if your grid is the 'only' part of your iframe/web page
var viewport=new Ext.Viewport({
layout: 'fit',
monitorResize : true,
items: [exceptionGrid ]
})
3.If the problem is only with scroll bars,then use
viewConfig: {
forceFit: true
}
4.You can always set the width: window.screen.width - 20 (apply some math around it to make it according to your necessity) and similarly height.
Hello I got problem with scroll on my grid.
Here is the code (nothing fancy or special in it)
Ext.define('grid.list',{
alias:'widget.grid.list',
extend: 'Ext.grid.Panel',
title: 'list',
frame:true,
width:325,
store: new axs.dry.cargo.data.store.list,
queryMode: 'remote',
style:{
cursor: 'default'
},
viewConfig: {
autoScroll: true
},
features:[Ext.create('Ext.grid.feature.Grouping',{
groupHeaderTpl: '{name}'
})],
columns: [
{
text: 'Name',
flex: true,
dataIndex: 'name',
sortable: false
}
],
initComponent:function(){
this.on('beforerender',function(){
this.store.load();
});
grid.list.superclass.initComponent.apply(this,arguments)
}
})
Grid is looking good and the scroller is showing BUT over the scrollbar extjs generates a DIV who is making the real problem. Because of that div I CAN'T click on the scrollbar because the transparent DIV is over it.... here is the code of this useless DIV
<div id="gridscroller-1032" class="x-component x-scroller x-scroller-vertical x-component-default x-docked x-docked-right x-component-docked-right x-component-default-docked-right" style="width: 17px; height: 297px; left: 302px; top: 47px; " role="presentation"><div class="x-stretcher" id="ext-gen1392" style="width: 1px; height: 2953px; "></div></div>
I hear opinion that this div is generated for "infinitive grid" but ...
Can you help me with good solusion (removing the element by selecting its ID is not a good solusion)
PS. When I remove the fixet width of my grid.list element the problem gone ... but then it starts showing horisontal scroll bar who looks ugly and I can remove it only by setting the width to fixed size.
PS2. I'm using the default css files and no special styles or anything.
The problem fixed by itself. I have integrate my form in the main project and the scrollbar appears...
I don't know why is that happening, maybe it is extjs bug.
Each of my 3 Extjs gridpanels do not expand horizontally within a tabPanel.
The each grid's properties:
id: grid_id,
ds: ds,
cm: cm,
loadMask: true,
view: grouping_view,
plugins: [expander, filters],
stateId: which + '-grid-stateId',
stateful: true,
stateEvents: ['datachanged', 'columnresize', 'columnmove', 'sortchange', 'columnvisible', 'columnsort', 'hide', 'show', 'expand', 'collapse'],
selModel: checkbox,
// height: 400,
width: GRID_WIDTH,
defaults: {autoHeight: true},
autoHeight: true,
collapsible: false,
animCollapse: false,
layout: 'fit',
TabPanel's properties:
id: 'tab_panel',
renderTo: 'tabs',
activeTab: 0,
enableTabScroll: true,
defaults: {autoScroll:true, authHeight:true},
plugins: new Ext.ux.TabCloseMenu(),
width: GRID_WIDTH + 2,
autoHeight: true,
items: [ // put items in tabpanel like this. adding via method call forces them to render/load befire user clicks on them
owned_grid,
managed_grid,
subscribed_grid
],
Layout is not a valid property for a GridPanel.
Try using:
viewConfig: { forceFit: true }
instead
I was searching the forums for a way to make my grid resize automatically but could not find the solution, nothing worked... and then I read the Ext Js GridPanel documentation: "
A grid requires a width in which to
scroll its columns, and a height in
which to scroll its rows. These
dimensions can either be set
explicitly through the height and
width configuration options or
implicitly set by using the grid as a
child item of a Container which will
have a layout manager provide the
sizing of its child items (for example
the Container of the Grid may specify
layout:'fit')."
..so I just set not the grid's layout, but the layout of the grids's PARENT to whatever value I want (in my case the parent container holds other things than only the grid, so I set layout : 'anchor', and then by setting the the anchor : '100% 100%' I make the grid expand as much as it can be).
and now I HAVE IT WORKING :D yayyyy!
It's the layout of the container that you have to set, ie:
var tp = new Ext.TabPanel({
items: [{
title: 'First tab',
layout: 'fit',
items: new Ext.GridPanel({ title: "Grid panel" })
},{
title: 'Second tab'
}]
});
Fit layouts mean that there is only one item in the container and it should expand to take all available space. Remove all explicit references to width, autoWidth, etc.