ExtJs Combobox Resize Problem on IE6 - combobox

A Combobox in the following constellation (extremely pruned code) has problems resizing in IE6. A little debugging revealed that it doesn't receive an event when trying to shrink the west region via splitter.
Ext.onReady(function(){
var grid = new Ext.Viewport({
layout: 'border'
,items: [{
region: 'west'
,width: 200
,layout: 'fit'
,split: true
,items: [{
layout: 'accordion'
,items: [{
layout: 'Anchor'
,items: [{
xtype: 'combo'
,anchor: '100%'
,typeAhead:true
,triggerAction: 'all'
,selectOnFocus: true
,mode: 'local'
,emptyText: 'bitte wählen'
,displayField: 'displayText'
,store: new Ext.data.ArrayStore({
fields: ['displayText'],
data: [['item1'], ['item2']]
})
}]
}]
}]
},{
region: 'center'
,html: 'content'
}
]
,renderTo: Ext.getBody()
});
});

It only happens within an accordian layout. Investigate that further.
Ext.onReady(function() {
var grid = new Ext.Viewport({
layout: 'border'
,items: [{
region: 'west'
,width: 200
,split: true
--,layout: 'fit' << not necessary. You're overnesting.
,layout: 'anchor'
,items: [{
xtype: 'combo'
,anchor: '100%'
,typeAhead:true
,triggerAction: 'all'
,selectOnFocus: true
,mode: 'local'
,emptyText: 'bitte wählen'
,displayField: 'displayText'
,store: new Ext.data.ArrayStore({
fields: ['displayText'],
data: [['item1'], ['item2']]
})
}]
},{
region: 'center'
,html: 'content'
}]
})
});
The above works fine for me in IE6

I hope this helps you.
Extract from AnchorLayout doc:
AnchorLayout does not have any direct
config options (other than inherited
ones). However, the container using
the AnchorLayout can supply an
anchoring-specific config property of
anchorSize. By default, AnchorLayout
will calculate anchor measurements
based on the size of the container
itself. However, if anchorSize is
specifed, the layout will use it as a
virtual container for the purposes of
calculating anchor measurements based
on it instead, allowing the container
to be sized independently of the
anchoring logic if necessary.
The items added to an AnchorLayout can
also supply an anchoring-specific
config property of anchor which is a
string containing two values: the
horizontal anchor value and the
vertical anchor value (for example,
'100% 50%'). This value is what tells
the layout how the item should be
anchored to the container. The
following types of anchor values are
supported:
Percentage: Any value between 1 and
100, expressed as a percentage. The
first anchor is the percentage width
that the item should take up within
the container, and the second is the
percentage height. Example: '100% 50%'
would render an item the complete
width of the container and 1/2 its
height. If only one anchor value is
supplied it is assumed to be the width
value and the height will default to
auto.
Offsets: Any positive or
negative integer value. The first
anchor is the offset from the right
edge of the container, and the second
is the offset from the bottom edge.
Example: '-50 -100' would render an
item the complete width of the
container minus 50 pixels and the
complete height minus 100 pixels. If
only one anchor value is supplied it
is assumed to be the right offset
value and the bottom offset will
default to 0.
Sides: Valid values are
'right' (or 'r') and 'bottom' (or
'b'). Either the container must have a
fixed size or an anchorSize config
value defined at render time in order
for these to have any effect.

I had a similar problem. Try putting the combobox in a container. So instead of putting it directly in the panel with the anchor layout, put the combo in a container and add this container to the panel with the anchor layout! It should work!

Related

tui-calendar doesn't display properly in ExtJS panel

I've been looking at adding a simple calendar to an ExtJS app and like the features of the tui-calendar.
I've started with just trying to display a month in a panel. I've tried various layouts, length and width configs, but the calendar never fully displays. Here's a fiddle showing the results.
Any ideas what I'm missing?
Thanks in advance,
Gordon
You can use layout: 'fit' on the panel and set the div's width and height to 100% with html style, like <div id="calendar" style="width:100%;height:100%"></div>. This way you:
tell the panel (which has a fixed size) that it will have one child that should occupy all available area,
tell the div which contains the calendar to use 100% of the available place horizontally and vertically.
Ext.create('Ext.panel.Panel', {
renderTo: document.body,
height: 600,
width: 600,
layout: 'fit',
tbar: [{
xtype: 'button',
text: 'Display Calendar',
handler: function (button) {
const container = document.getElementById('calendar');
calendar = new tui.Calendar(container, options);
calendar.setDate('2023-03-01');
}
}],
items: [{
html: '<div id="calendar" style="width:100%;height:100%"></div>',
xtype: 'component'
}]
});
I'd like to note that I am not sure that this way ExtJS will manage the life cycle of the calendar object. I would recommend to keep track of the created calendar object and destroy it when the panel is destroyed. To do so, add a destroy listener event to the panel and destroy the calendar object there.

Ext.form.combobox inside ext.window displays values at top left of screen

I have a combobox inside of a ext.panel, inside of an ext.window. When I click the down arrow to show the possible SELECT options, the options pop up at the top-left of the browser window, instead of below the SELECT box. The funny thing is if I attach the drugDetailsPanel (see code below) to a div on the page (instead of inside an ext.window), the combobox works correctly. This also happens when I change ext.panel to ext.form.formpanel, by the way.
Any ideas?
My code:
drugDetailsPanel = new Ext.Panel({
layout:'form',
id:'drug-details-panel',
region:'center',
title:'Drug Details',
height:200,
collapsed:false,
collapsible:false,
items:[
new Ext.form.ComboBox({
fieldLabel:'What is the status of this drug?',
typeAhead:false,
store:drugStatusStore,
displayField:'lookup',
mode:'remote',
triggerAction:'all',
editable:false,
allowBlank:false,
emptyText:'Select a status..',
name:'/drug/drug-status',
id:'drug-status'
})
]
});
newDrugWindow = new Ext.Window({
title: 'Add Drug',
closable:true,
width:650,
height:650,
//border:false,
plain:true,
layout: 'border',
items: [drugDetailsPanel],
closeAction:'hide',
modal:true,
buttons: [
{
text:'Close',
disabled:false,
handler: function(){
newDrugWindow.hide();
}
},
{
text:'Save Drug',
handler: function(){
newDrugDialog.hide();
}
}]
});
Try to add shim: true to combo-box control.
Older versions of Ext had issues like this in certain browsers (FF 2.x) in certain situations dealing with nested positioning, the specifics of which escape me now. If that's the case, search the Ext forums for more info. If not, then I'm not sure...
This forum thread helped me: http://www.sencha.com/forum/showthread.php?177677-IE-displays-combobox-dropdown-in-the-top-left-corner-of-browser-window
Just give the combobox a (unique) name. Giving the combobox an inputId should also help
Seems like IE does not respect the position of the element if it does not have an explicit name/inputId. This thread goes more deeply into it: http://www.sencha.com/forum/showthread.php?154412-Combo-Box-options-appears-in-Top-Left-Corner-in-IE-9

Force Ext to create body element for hidden (collapsed) panel

I've created a panel bundled with an Ext.Template. This panel is contained in another panel that starts its life collapsed.
id: 'myPanel',
title: 'My Title',
layout: 'border',
collapsible: true,
collapsed: true,
hideCollapseTool:true,
bodyBorder: false,
height: 300,
bodyStyle: 'background:#F9F9F9;',
items: [{
id: 'myDisplayPanel',
bodyStyle: 'background:transparent;',
width: 300,
border: false,
margins: '5 5 5 5',
region: 'west',
tpl: new Ext.Template([
'some template'
])
},
{
id: 'myForm',
xtype: 'form',
bodyStyle: 'background:transparent;',
border: false,
margins: '5 5 5 5',
region: 'center',
[...]
This template-panel is supposed to be updated as the result of a row select in a neighbouring grid. But I get an error the first time I call .update(data); on the myDisplayPanel, as it contains no body element.
myGridSelectionModel: new Ext.grid.RowSelectionModel({
singleselect: true,
listeners: {
rowselect: function(sm,rowIdx,r) {
Ext.getCmp('myDisplayPanel').update(r.data);
Ext.getCmp('myPanel').expand(true);
}
}
}),
The call to myDisplayPanel.update() causes an error when Ext tries to call the template.overwrite function with myDisplayPanel.body as the first param.
function(b,a,c){b=Ext.getDom(b);b.innerHTML=this.applyTemplate(a);
Is it possible somehow to force Ext to generate a body element for this hidden panel before it is beeing shown? I've tried to expand the element prior to updating it, but this has now effect...
I know this thread is 2 months old, so I'm not sure if you ever found a solution. However, I just ran into the same thing and came across your thread while looking for an answer. This is what I ended up doing:
Where you're currently running panel.update(content), try this:
if(panel.rendered) panel.update(content);
else panel.contentToLoad = content;
Set up a listener for the render event to run:
if(this.contentToLoad) panel.update(this.contentToLoad);
That way, if the panel isn't rendered, it will store the content somewhere and the render listener will load whatever is there when the panel IS rendered.
Collapsed panels (and hidden containers in general) by default do not layout their children until they first become visible. You can override this behavior by setting forceLayout: true on the collapsed container. As the name suggests, this will force the container to perform its layout whether it is visible or not. Note that in your case this would be myPanel that would need this configuration, not myDisplayPanel.
You might try Panel's elements config, which from the docs is "A comma-delimited list of panel elements to initialize when the panel is rendered." So e.g.,
elements: ['header','body']
However it already defaults to 'body' only, so it may just be that the panel is truly not rendered yet when you are updating it. Try reversing the order of your calls so that the container is expanded first (should force the child panel to render) then update it.

Ext JS - Cannot get textfield label to show in column layout

Inside my FormPanel , I have a fieldset with a layout of 'column'.
I have tried several different config properties but i cannot get the label for my textfield to work. It just renders the textbox without a label.
(Obviously, if i make the layout type 'form', i have no issues). The text for the checkboxes shows fine, but the textbox label does not. Can someone point out what is wrong ?
thanks!
xtype:'fieldset',
title:'Transaction Status',
layout: 'column',
style:'margin:5px;'
,height:125//or:'-20', allowBlank:false}
,defaultType: 'checkbox'
,defaults: {
columnWidth: '.32',
border: false
},
items: [{
id:'check1-field',
name: 'check1',
boxLabel: 'DOT'
},{
id:'check2-field',
boxLabel: 'Results Matched',
name: 'check2'
},{
xtype:'textfield',
name: 'testname',
fieldLabel:'This doesnt show'
}
]
Ext Docs for TextField
"This config is only used when this Component is rendered by a Container which has been configured to use the FormLayout layout manager."
So, since you have a layout of "column", I don't think it will render.
Best best is probably to place your check boxes in a separate field set below the text entry boxes, or just remove the column layout style and change it to form (the default).
I had the same problem with you..
I solved it using panel xtype.
set your checkboxes becomes the items of a panel.

ExtJS Toolbar with multiple rows

Is it possible to have an ExtJsToolBar with multiple lines? I want a few controls on the first line and 3 ExtJsButtons on the 2nd.
The toolbar is the top toolbar of a Panel.
Not sure about earlier versions, but as of ExtJS 4.0 you can do it like this when you're defining the grid:
dockedItems: [
{
xtype: 'toolbar',
dock: 'top',
items: [
{text:'Toolbar 1 Button 1'},
{text:'Toolbar 1 Button 2'}
]
},
{
xtype: 'toolbar',
dock: 'top',
items: [
{text:'Toolbar 2 Button 1'}
]
}
],
http://dev.sencha.com/deploy/ext-4.0.2a/docs/#/api/Ext.panel.Panel
You haven't mentioned to what widget you like to add toolbars, but in general you may add as many toolbars as you want:
var panel = new Ext.Panel();
var tool1 = new Ext.Toolbar({...});
var tool2 = new Ext.Toolbar({...});
panel.add(tool1);
panel.add(tool2);
...
If you like to add extra toolbar to the top of grid, then do find grid's panel component and add toolbars to it. It could look like this (not tested):
tPanel = grid.getTopToolbar().ownerCt; // get top toolbar's container panel
tPanel.add(anotherToolbar);
What about dockedItems its much simpler too.
var toolbar1 = {
xtype : 'toolbar',
dock : 'top', // bottom, right, left
items: [...]
};
var toolbar2 = {
xtype : 'toolbar',
dock : 'top',
items: [...]
};
Ext.create('Ext.panel.Panel', {
dockedItems: [toolbar1,toolbar2]
});
I know its quite old and already answered, may be it can help someone :)
I'm not sure if this is exactly what you are looking for but Toolbars has been revamped in Ext 3.0.
You might want to take a peek at:
http://extjs.com/deploy/ext-3.0-rc1.1/examples/toolbar/toolbars.html
I'm not sure, whether it's possible or not, but what you can always do is to divide north area (if using border layout for example) into two rows using row layout. Then you can add one toolbar to the top row and the other one to the second row.
Look at this thread in the Ext forum. It describes how to create a toolbar and render it to an existing toolbar.
http://www.extjs.com/forum/showthread.php?t=12433

Resources