I'm new using Sencha Touch 2, and I've started developing a Tablet App. I'm using Sencha Architect for design and write the code, and my app has a card layout with "left-side" and "right-side". On the left I have a main menu with some buttons. This menu is all time on the left. On the right side, I want to change the views depending what menubutton was clicked and where the user want to go (It will have more than 3 levels navigation after every button click).
My problem now is "How to change the views?". Until now, I had a Navigation.View on the right, and I has using this.getPanelFrame().push(view); method. I have problems with toolbars when a load something into navegation.view, and I know how to create views and push, but after thant I dont know how to load this views again.
I Link too an image where you can the structure of my components. My main doubt is: do I have to use a navigation.view as a "frame" to load inside other views? How to change an load others? Any alternatives?
Thanks a million"
CONTROLLER
Ext.define('MyApp.controller.Main', {
extend: 'Ext.app.Controller',
config: {
refs: {
panelFrame: '#PanelFrame'
},
control: {
"button#btnclientes": {
tap: 'onBtnclientesTap'
},
"#btnpedidos": {
tap: 'onBtnpedidosTap'
}
}
},
onBtnclientesTap: function(button, e, options) {
var view = Ext.create("MyApp.view.ClientesListView");
this.getPanelFrame().push(view);
},
onBtnpedidosTap: function(button, e, options) {
var view = Ext.create("MyApp.view.ClientesNewView");
this.getPanelFrame().push(view);
}
});
why dont you create a container in the right side.
and then in the items: call each view with the xtype
{
xtype: 'container',
items: [
{
xtype: 'view1',
id: 'Cview1',
hidden:true,
},
{
xtype: 'view2',
id: 'Cview2',
hidden:true,
},
{
xtype: 'view3',
id: 'Cview3',
height:'auto',
hidden:true,
}]
and then in the handler of the button you just hide the other views and show your selected view like:
{
xtype: 'button',
handler:function(){
Ext.getCmp('Cview1').hide();
Ext.getCmp('Cview2').hide();
Ext.getCmp('Cview3').show();
}
}
Related
I am trying to show a qtip when the user right-clicks on a node using the following code:
cy.on("cxttap", "node", function (evt) {
evt.cyTarget.qtip({
content: {
text: "test"
}
});
});
When I right-click a node no tooltip is shown, but as soon as I left-click on the same node then the tooltip shows.
I have made sure that cytoscape-qtip is working and I have not added any event handlers for the click or tap events.
qTip handles events itself, so you have to specify something like cxttap for the show event. If you want to write your own listeners, like you have above, then your call to qtip will need a call to the qtip API to manually show.
Set show property for right click
cy.elements().qtip({
content: '<p> [SUM Outgoing call :42, THUVAPPARA</p><button id="add-to-report" class="btn btn-success">Add to report</button><br><button class="btn btn-danger">Remove</button>',
show: { event: 'cxttap' },
position: {
my: 'top center',
at: 'bottom center'
},
style: {
classes: 'qtip-bootstrap',
tip: {
width: 16,
height: 8
}
}
});
I'm trying to add a colorbutton in a TinyMCE dialog box to replace my old color selector which was initially created with a select input.
See : ColorButton : API 4.X
This class creates a color button control. This is a split button in which the main button has a visual representation of the currently selected color. When clicked the caret button displays a color picker, allowing the user to select a new color.
I can add and see the new colorbutton in the dialog box but it doesn't show the colorpicker when clicked.
Here is my code:
editor.windowManager.open( {
title: 'Choose color',
body: [
{
type: 'listbox',
name: 'bg-color',
label: 'Color (select)',
'values': [
{text: 'White', value: '#FFF'},
{text: 'Black', value: '#000'},
{text: 'Silver', value: 'silver'},
]
},
{
type: 'ColorButton',
name: 'bg-color2',
label: 'Color (colorpicker)',
},
],
onsubmit: function(e) {
// Do something here
}
});
And you will find a tinymce fiddle here to illustrate this issue:http://fiddle.tinymce.com/sfeaab
Since my debugger doesn't show any JS error, is there something wrong in this code or is there another way to add a colorpicker in a dialogbox?
Thanks!
#MavBzh I think you've a wrong perception on how the color button works. The ColorButton UI is only help with rendering a button which not much difference with PanelButton UI. you can see this example http://fiddle.tinymce.com/sfeaab/3 in this fiddle I use textcolor plugin example.
So, in order to use color button you're required to specify the Panel to hold the color picker.
{
type: 'colorbutton',
name: 'color',
text: 'Color',
selectcmd: 'ForeColor',
panel: {
role: 'application',
ariaRemember: true,
html: renderColorPicker,
onclick: onPanelClick
},
onclick: onButtonClick
}
then later set onclick callback action and render the color picker HTML output yourself, the renderColorPicker function is used as the panel content, then assigned onPanelClick callback to put the color to the text placeholder in the ColorButton.
PS: in the fiddle I used v4.0.21
I am playing an audio track in sencha touch. Its working fine.. But I want two things.
1) How to hide audio player and autoplay the sound. For this I tried
autoplay:true, and
hidden:true,
But this is not working ..
2) I want to add a button for sake of playing audio i.e. It contains the text "Tap to Play"
and when it is tapped it turns Pause .. And when pause tapped it turns to Play ..
I have done this but It does not Work well at all.. i.e. first i have to tap play button at the player and then My customize button came into action ..
Kindly help me to get out of this ..
{
xtype: 'audio',
url: 'lib/touch/snd/sound.mp3',
id: 'sound1',
autoplay:true,
hidden:true
},
{
xtype: 'button',
text:'Tap to play audio',
handler: function() {
var container = this.getParent().getParent(),
// use ComponentQuery to get the audio component (using its xtype)
audio = container.down('audio');
audio.toggle();
this.setText(audio.isPlaying() ? 'Pause' : 'Play');
}
}
Please refer to documentation...
link
It should be something like this
{
xtype: 'audio',
url: 'lib/touch/snd/sound.mp3',
id: 'sound1',
autoplay:true,
hidden:true
},
{
xtype: 'button',
text:'Tap to play audio',
handler: function() {
Ext.getCmp('#sound1').play(this,erg); or
Ext.getCmp('#sound1').pause(this,0,erg);
}
}
Is it possible to create a item in a tabbar-ed card layout, that has no tab?
I want to create a message overlay that stretches from screen top to the tab bar and doesn't cover the tab bar. When i do this by adding an item to the panel everything works fine except a blank icon is created on the tabbar. Is there a way to prevent this icon from being created?
you can create the new item with hidden: true config option
Ext.define('App.view.settings.SettingsContainer', {
extend: 'Ext.tab.Panel',
xtype: 'settingsContainer',
requires : [
...
],
config: {
tabBar: {
docked: 'top'
},
tab: {
title: 'Settings',
iconCls: 'user'
},
items: [{
xtype: 'settingsAccountContainer'
}
, {
xtype: 'changeCompanyView',
hidden: true
}]
}
});
changeCompanyView is created, but no tab icon is visible.
It could be activated by
settingsContainer.setActiveItem(1);
Cheers, Oleg
This should work. Add the overlay to the child item and not the tab panel.
childPanelItem.add(
Ext.create('Ext.Panel',
{
xtype:'panel',
html:'Demo',
top:0,
left:0,
right:0,
bottom:0
}
)
);
If you add to the child panel the icon will not appear on the tab bar.
I have some problem with complex objects on tabpanel.
I have 2 complex objects with stores, windows, grids, trees and etc. Here is the beginning of the object:
Ext.define('Ext.app.DocumentsContainer', {
extend: 'Ext.container.Container',
initComponent: function(){
var documentsStore = Ext.create('Ext.data.Store', {
And I have tabpanel with 2 panels(one for each object).
full code of viewport with tabpanel:
Ext.create('Ext.container.Viewport', {
layout: 'border',
padding: '5',
items: [
{
xtype: 'container',
region: 'north',
height: 50
},
{
xtype: 'tabpanel',
activeTab: 0,
region: 'center',
width: 100,
items: [
{
xtype: 'panel',
title: 'Documents',
layout: 'border',
items: Ext.create('Ext.app.DocumentsContainer'),
},{
xtype: 'panel',
title: 'Transmittals',
layout: 'border',
items: [Ext.create('Ext.app.TransmittalsContainer')],
}]
}
],
});
When I testing my page, a have a problem, because somehow data from one object dysplays in grid in another object, or doesnt dysplay at all.
But both objects working correctly one at a time.
I think, I can fix it by dynamically loading objects when tab is opened, but dont know how can I do it.
Any suggestions?
Without knowing the internals of your two components Ext.app.DocumentsContainer and Ext.app.TransmittalsContainer one cannot reliably answer your question. Perhaps you assign the same ID to two different internal components - that's most often the reason for mixed up data.
Secondly, Frederic is right - you're overnesting your components. Both panels inside the tabpanel are unnecessary because you can put your components directly into the tabpanel as illustrated by Frederic. However, if you insist to keep your panels, try changing the layout to fit because that layout-type handles single-item-components (sized the single component to fit into the parent frame).
You are overnesting the tabpanel. The tabpanels items will automatically stretch their content. So it might just work for you.
Do this instead. Change DocumentContainer to pe panel (so it can have a title. )
Ext.define('Ext.app.DocumentsContainer', {
extend: 'Ext.panel.Panel',
initComponent: function(){
var documentsStore = Ext.create('Ext.data.Store', {
And change you tabpanel to this. I also deleted the width on your center region. center regions fills out the rest of the border layouts space automatically.
Ext.create('Ext.container.Viewport', {
layout: 'border',
padding: '5',
items: [
{
xtype: 'container',
region: 'north',
height: 50
},
{
xtype: 'tabpanel',
activeTab: 0,
region: 'center',
items: [
Ext.create('Ext.app.DocumentsContainer', {title:'Documents'}),
Ext.create('Ext.app.TransmittalsContainer', {title:'Transmittals'})
]
}
],
});
Also. as Stefan mentioned. Never ever use id´s in your ExtJS4 code. They are evil and will freck your result up eventually. itemId or just simple Ext.DomQuery is the way to do it.