I'm writing an app in Sencha-touch. I have 3 tabs in a tab panel. I'd like each one to take up 33% of the width of the tab panel. I've tried using resizeTabs, tabWidth, and even added a class to each item and then referenced it in css to change the width.
Then I also tried using a span element in the html and referencing that. But none of it works. My code is below. How do I change the width of the tabs in a tab panel?
{
xtype: 'tabpanel',
fullscreen: true,
tabBarPosition: 'top',
resizeTabs: true,
tabWidth: '33%',
items:[
{
//title: 'Campus List',
html: '<span class="headerTab">Campus List</span>',
width: '33%',
cls: 'headerTab'
},
{
title: 'Meter List',
html: 'Meter List',
width: '33%',
cls: 'headerTab'
},
{
title: 'Meter',
html: 'Meter',
width: '33%',
cls: 'headerTab'
}
]
}
I figured it out. If you reference the xtype of the tab, not the tabpanel, in your css then it will resize the tabs. Here's what worked.
.x-tab{
width: 33%;
}
{
xtype: 'tabpanel',
tabBarPosition: 'top',
**
defaults: {
flex: 1 //set the width of each item to be equal, in this case => 100%/numberOfItems = 100%/3 = 33.33333%
}
**
items:[
{
title: 'Campus List'
},
{
title: 'Meter List'
},
{
title: 'Meter'
}
]
}
have you tried using "flex" config ?
this the solution that I use
{
xtype: 'tabpanel' ,
fullscreen: true,
tabBarPosition: 'top',
resizeTabs: true,
// use this it helps
minTabWidth : 75,
//*********
items:[
{
//title: 'Campus List',
html: '<span class="headerTab">Campus List</span>',
width: '33%',
cls: 'headerTab'
},
{
title: 'Meter List',
html: 'Meter List',
width: '33%',
cls: 'headerTab'
},
{
title: 'Meter',
html: 'Meter',
width: '33%',
cls: 'headerTab'
}
]
}
Related
I trying renderTo a panel(Ext.panel with title:'titlet' in the end of code) to the mainView ('Foresto.view.main.Main') or to a part of courusel (id:'mapId') But i havn't got a positive result.
So my quistions:
1) How to render panel to the mainview or to a courusel item ('mapId')
2)What mains approaches in Ext JS 6+, modern toolkit, for render object to the mainview or mainview's elements??
Now my code looks like that:
Ext.define('Foresto.view.main.Main', {
extend: 'Ext.form.Panel',
id:"control-panel",
plugins: 'responsive',
responsiveConfig:{
tall:{
tabPosition:'center'
}
},
xtype: 'app-main',
controller:'menuform',
requires: [
'Foresto.view.map.Map',
'Foresto.view.main.ButtonController',
'Foresto.view.forms.LoginRoom'
],
autosize:true,
padding: 0,
id:"bighBox",
header: {
cls: 'header-cls',
title : {
cls : 'header-title-cls',
text : 'FOREST'
}
},
tools: [{
type: 'menu',
handler: function() {
Ext.Viewport.toggleMenu('top');
}
}],
items:[{
xtype: 'carousel',
id: "mainPart",
flex: 1,
defaults: {
border: true,
ui: 'light'
},
items: [{
title: 'MAP',
id:'mapId',
xtype: 'panel',
layout:'vbox',
padding: 0,
items: [{
xtype: 'panel',
title:'PLACEFORMAP'
}]
},{
title: 'REPORTS',
xtype: 'panel',
cls: 'foresBack',
layout: {
type: 'hbox',
align: 'middle',
pack: 'center'
},
items:[{
xtype:'button',
cls:'threethbutton',
ui: 'confirm',
text:'REPORT1',
margin:'10px'
},{
xtype:'button',
cls:'threethbutton',
ui: 'confirm',
text:'REPORT2'
}]
}]
}
],
initialize: function() {
Ext.Viewport.add({
xtype:'button',
id:'pan11111',
text:'KAB',
flex:1,
height: 1000,
width: 100,
items:[{
xtype:'tabpanel',
title:'Projects',
layout:'card',
items:[{
xtype:'panel',
title:'11111'
},{
xtype:'panel',
title:'uuuuu'
}]
}]
});
}
}});
now I edit function for rendering panel on viewport. Panel 'pan11111' is rendering, bu viewport cover all other elements, and I can work only with panel and white board viewport, witch cover all classes: –THIS problem was solved by great clearning of coockies
I have aded extjs window as follows,
var popupWindow = me.popupWindow = new Ext.window.Window({
autoHeight: true,
itemId: 'popup',
cls: 'premier-window',
width: 550,
height: 280,
layout: {
pack: 'center'
},
shadow: false,
modal: true,
frame: false,
resizable: false,
isPremierPanel: true,
usePremierCloseButton: true,
closeAction: 'hide',
dockedItems: [
{
dock: 'bottom',
xtype: 'toolbar',
itemId: 'button_toolbar',
style: 'background:#F5F3F4;broder:0',
items: [
{
dock: 'bottom',
xtype: 'button',
itemId: 'btnOk',
style: 'margin-left:230px;background:#D3D3D3;',
text: 'OK',
width: 70,
handler: me.okClicked,
scope: me
}
]
}
],
style: 'background-color:#F5F3F4; font-size:11px; padding-bottom:10px; margin-left:10px;',
html: '<div style="padding-left: 7px;padding-right: 7px;padding-top: 7px;font-size:12px;">'
});
popupWindow.show();
popupWindow.setTitle('Restricted Access');
How to customize closeAction functionality of an extjs window?
I want to do something other than destroying or hiding the window when clicked on default close button of a window.
listeners:{
beforeclose:function() {
if(I_DONT_WANT_TO_CLOSE) {
doSomethingAndDontCloseTheWindow()
return false;
}
}
close:function() {
doSomethingAfterWindowHasBeenClosed();
}
}
beforeclose in the docs.
close in the docs.
I have the following accordian layout. Each panel takes entire height of the container. Is there any way I could limit the child panels height to be limited to whatever the panel has to display? I tried fill: false and that didn't work.
Ext.define('T.view.Test', {
id: 'Test',
extend: 'Ext.Panel',
alias: 'widget.Test',
title: 'PANEL CONTAINER',
layout: {
type: 'accordion',
align: 'stretch',
pack: 'start',
fill: false
},
height: 300,
initComponent: function () {
Ext.apply(this, {
items: [{
xtype: 'panel',
flex: 1,
title: 'panel1',
html: 'this is first panel'
}, {
xtype: 'panel',
title: 'panel2',
flex: 1,
html: 'this is the next panel'
},{
xtype: 'panel',
title: 'panel3',
flex: 1,
html: 'this is the 3rd panel'
}]
});
this.callParent(arguments);
}
});
Ext.create('T.view.Test', {
renderTo: Ext.getBody()
});
JSFiddle: https://jsfiddle.net/kavitaC/2c52aby4/1/
fill: false does not work because the panels have flex: 1. Just remove flex from all panels and that's it!
What I'm trying to do is add a grid that is 65% width of the panel created in my app.js
Ext.application({
name: 'AM',
appFolder: 'app',
controllers: [ 'Metadata', 'Print', 'Export' ],
launch: function() {
var types = Ext.create('AM.store.Type');
Ext.create('Ext.panel.Panel', {
renderTo: Ext.getBody(),
width: 1000,
height: 600,
title: '<center>MetaCenter</center>',
layout: 'hbox',
style: { marginLeft: 'auto', marginRight: 'auto' },
items: [
{ xtype: 'panel', padding: 5, height: 500, width: '35%',
items: [
...
{ xtype: 'button', text: 'Search',
listeners: {
click: function() {
console.log('Search Button clicked');
//Code to create panel view?
}
},
],
}
I'm not explicitly creating a viewport, so I don't believe I could do a viewport.add('grid') function, but I'm not sure. Any ideas?
You could add the grid when creating the container, with hidden: true, then show it when the button is clicked:
{
layout: {
type: 'hbox',
align: 'stretch'
},
items: [
{
xtype: 'panel',
flex: 0.35,
items: [
...
{
xtype: 'button',
text: 'Search',
listeners: {
click: function(btn) {
btn.up('panel').nextSibling().show();
}
}
}
]
},
{
xtype: 'grid',
flex: 0.65,
hidden: true,
...
}
]
}
I have an item like so (JSFiddle Demo):
{
region: 'west',
title: 'Instead of toolbar',
collapsible: true,
width: 250,
tbar: [{
xtype: 'button',
text: 'Button',
style: {
background: 'green'
},
handler: function() {}
}]
}
I want my tbar instead of the title like (1->2)
I tried to remove title but it's not working. How to do that thanks :).
Get rid of the header and add the same collapse tool to the toolbar:
{
region: 'west',
collapsible: true,
header: false,
width: 250,
tbar: [
{
xtype: 'button',
text: 'Button',
style: {
background: 'green'
},
handler: function (){}
},
'->',
{
type: 'left',
xtype: 'tool',
handler: function(t) {
this.up('panel').collapse();
}
}
]
}