i need to intimate the user that toolbar contains the scroll bar and there is some more buttons in the toolbar.
Any sample code for the issue.
thanks in advance...
You may try something like this (in Sencha Touch 2):
var toolbar = Ext.create('Ext.Panel', {
id: 'meetingList',
flex: 1,
scrollable: {direction: 'horizontal', indicators: false},
defaults: {width: 200},
items: [{
xtype: 'button',
text: 'Button1'
},{
xtype: 'button',
text: 'Button2'
},
....
]
});
Related
I have a toolbar with buttons that are hidden by default, and then shown based on the user's privileges. They appear and function after I call .show(), but do not appear in the overflow menu when the window is resized. The items that are initially shown appear in the overflow menu correctly.
Any advice on how I can fix this problem?
Thanks
Edit: Here's the simplest example I could come up with that works with fiddle for the problem. https://fiddle.sencha.com/#fiddle/877
Ext.onReady(function(){
var toolbar1 = Ext.create('Ext.toolbar.Toolbar', {
region: 'north',
layout: {
overflowHandler: 'Menu'
},
items: [{
xtype: 'textfield',
emptyText: 'FIX ME'
},{
xtype: 'button',
text: 'Test Lists',
id: 'testListsButton',
hidden: true
},{
xtype: 'button',
text: 'All Lists',
id: 'allListsButton',
},{
xtype: 'button',
text: 'Other Lists',
id: 'otherListsButton',
hidden: true
},{
xtype: 'button',
text: 'Email Lists',
id: 'emailListsButton',
hidden: true
}]
});
Ext.getCmp('emailListsButton').show();
Ext.getCmp('otherListsButton').show();
Ext.getCmp('testListsButton').show();
var viewPort = Ext.create('Ext.container.Viewport', {
layout: 'border',
autoRender: true,
items: [
toolbar1
]
});
})
I found a work-around.
I set the items to be visible initially, hide them before they're rendered, and then show them again when checking the user's privileges. This properly displays the items in the overflow menu.
It looks like this is a bug, all be it a minor one.
I have an ExtJS 4.2.1 accordion layout with three panels.
When the app is first launched, the first panel is open and the 2nd/3rd are closed.
I can open and close the 2nd and 3rd, but I can never close the first panel.
Ext.define('MyAccordion', {
extend: 'Ext.container.Container',
alias: 'widget.myAccordion',
padding: 0,
margin: 0,
width: 200,
layout: {
type: 'accordion',
align: 'stretch',
animate: true,
hideCollapseTool: true
},
items: [{
xtype: 'panel',
title: 'Test Volumes',
layout: {
type: 'vbox',
align: 'stretch'
},
items: [{
xtype: 'label',
text: 'volume one'
},{
xtype: 'label',
text: 'volume two'
},{
xtype: 'label',
text: 'volume three'
}]
}, {
xtype: 'panel',
title: 'Production Volumes',
layout: {
type: 'vbox',
align: 'stretch'
},
items: [{
xtype: 'label',
text: 'volume one'
},{
xtype: 'label',
text: 'volume two'
},{
xtype: 'label',
text: 'volume three'
}]
}, {
xtype: 'panel',
title: 'Extra Volumes',
layout: {
type: 'vbox',
align: 'stretch'
},
items: [{
xtype: 'label',
text: 'volume one'
},{
xtype: 'label',
text: 'volume two'
},{
xtype: 'label',
text: 'volume three'
}]
}]
});
In the following code leveraged from the 4.2.1 examples layout browser example, if the first thing you do after launching the app is click the first header, is does close, but then re-open it and it never closes again:
Ext.onReady(function() {
Ext.create('Ext.container.Viewport', {
renderTo: Ext.getBody(),
items: [{
xtype: 'panel',
title: 'Accordion Layout',
layout: 'accordion',
defaults: {bodyStyle: 'padding:15px'},
items: [{
title: 'Introduction',
tools: [{type:'gear'},{type:'refresh'}],
html: '<p>Here is some accordion content. Click on one of the other bars below for more.</p>'
},{
title: 'Basic Content',
html: '<br /><br /><p>More content. Open the third panel for a customized look and feel example.</p>',
items: {
xtype: 'button',
text: 'Show Next Panel',
handler: function(){
Ext.getCmp('acc-custom').expand(true);
}
}
},{
id: 'acc-custom',
title: 'Custom Panel Look and Feel',
cls: 'custom-accordion', // look in layout-browser.css to see the CSS rules for this class
html: '<p>Here is an example of how easy it is to completely customize the look and feel of an individual panel simply by adding a CSS class in the config.</p>'
}]
}]
});
});
Even more strange, if I do show the collapse/expand tool, the tool for the first panel stops working.
Amazing but true, but this happens because the accordion layout container does not have a height set.
Because I can't have a fixed height, this fixes the issue: flex: 1
But this seems really strange, because why should not having a height (or flex, etc) break closing the first container? Just seems weird.
An easy solution would be to add _isLayoutRoot: true to panel with accordion layout.
Ext.define('myAccordion',{
extend: 'Ext.Panel',
alias: 'widget.myAccordion',
layout: 'accordion',
_isLayoutRoot: true,
items: myItems
});
Example: http://jsfiddle.net/38mx9hs9/1/
Also it seems that this issue is fixed in 4.2.2:
https://www.sencha.com/forum/showthread.php?267163-4-2-1-Accordion-Layout-in-Panel&p=1169533#post1169533
I need to popup an aspx page in a Extjs Popup window.For popup I am using Ext.Window.
Can someone help me how can I popup an Aspx page using Ext.Window?
Thanks in Advance.
You can add an iframe to the window. Here's an example derived from something i did recently:
Ext.define('App.view.myWindow', {
extend: 'Ext.window.Window',
title: 'My Window',
xtype:'myWindow',
itemId: 'myWindow',
width: 1500,
height:800,
items: [{
xtype: 'panel',
layout: {
type: 'hbox',
align: 'stretch'
},
items: [{
xtype: 'box',
itemId: 'iFrameInWindow',
title: 'IFrame',
autoEl: {
tag: 'iframe',
src: 'about:blank'
},
flex: 1
}]
}]
});
I am using ExtJS 4 and trying to add button on a tab panel header. Please have a look at this jsfiddle:
http://jsfiddle.net/ramarajuv/Sadnj/7/ . You can see it working fine with just the two tabs. Now, modify the same code by adding a tabBar as below:
Ext.create('Ext.panel.Panel',{
renderTo : Ext.getBody(),
id : 'testPanel',
height : 200,
width : 300,
items: [{
xtype : 'tabpanel',
activeTab : 1,
tabBar:[{
dockedItems:[{
xtype: 'button',
text : 'Test Button'
}]
}],
items: [{
title: 'tab1'
},{
title: 'tab2'
}]
}]
});
No Javascript error is thrown, but the button that I want to see to the right of the tab panel header is not coming up. Could you please help how I can bring up a button on the tab panel?
If I understand your question it seems you want the button to be in the tabBar itself and not in its own toobar? If that's the case then you can use the following code available in this fiddle.
http://jsfiddle.net/Sadnj/15/
Ext.create('Ext.panel.Panel', {
renderTo: Ext.getBody(),
id: 'testPanel',
height: 200,
width: 200,
items: [{
xtype: 'tabpanel',
activeTab: 1,
tabBar: {
items: [{
xtype: 'tbfill'
}, {
xtype: 'button',
text: 'Test Button'
}]
},
items: [{
title: 'tab1',
}, {
title: 'tab2',
}]
}]
});
you can use this:
Ext.create('Ext.panel.Panel',{
renderTo : Ext.getBody(),
id : 'testPanel',
height : 200,
width : 200,
items: [{
xtype : 'tabpanel',
activeTab : 1,
tbar:[{
text : 'txtButton'
}],
items: [{
title: 'tab1'
},{
title: 'tab2'
}]
}]
});
this will make buttons for your tabpanel.
Add button to tabpanel header simply with this:
tabBar: {
items: [
{ xtype: 'tbfill' },//fill the empty space between left and right
{
xtype: 'button',
text: 'Button 1'
}
]
}
i had made a panel with number of buttons in it like this,
Ext.define('BeLocal.view.Test', {
extend: 'Ext.Panel',
config: {
fullScreen: true,
height: 482,
width: 324,
scrollable: 'vertical',
items: [
{
xtype: 'button',
text: 'MyButton1'
},
{
xtype: 'button',
top: '30%',
text: 'MyButton2'
},
{
xtype: 'button',
top: '50%',
text: 'MyButton3'
},
{
xtype: 'button',
top: '96%',
text: 'MyButton4'
},
{
xtype: 'button',
top: '110%',
text: 'MyButton5'
}
]
}
});
i can show only 3 buttons now.
i want this panel scrollable so that i can show all the buttons by scrolling it down, i had set property scrollable: 'vertical' , but it doesn't work.
When i remove position of all buttons like top:50% scroll works properly, but i want all the buttons on proper position.
how can i fix this problem ?
As per the documentation:
http://docs.sencha.com/touch/2-1/#!/api/Ext.Button-cfg-top
top : Number/String
The absolute top position of this Component; must be a valid CSS length value, e.g: 300, 100px, 30%, etc. Explicitly setting this value will make this Component become 'floating', which means its layout will no longer be affected by the Container that it resides in.
Try setting style config:
items: [{
xtype: 'button',
text: 'MyButton1'
},{
xtype: 'button',
style:'margin-top: 10%;',
text: 'MyButton2'
},{
xtype: 'button',
style:'margin-top: 50%;',
text: 'MyButton3'
},{
xtype: 'button',
style:'margin-top: 96%;',
text: 'MyButton4'
},{
xtype: 'button',
style:'margin-top: 110%;',
text: 'MyButton5'
}]
Seems to works for me.