I am new to sencha touch, I am trying to display map in my sencha touch application. here comes the code
Ext.define("trackit.view.GoogleMaps", {
extend: 'Ext.Map',
config: {
mapOptions:{
//my map options
}
}
});
Ext.define("trackit.view.trackMap", {
extend: 'Ext.Panel',
requires: "trackit.view.GoogleMaps",
config: {
layout:'fit',
items: [{
docked: 'top',
xtype: 'toolbar',
ui: "light",
title: 'Track direction',
},
]
}
});
From the above code only toolbar is coming but not the map.Please help
It's because you only require trackit.view.GoogleMaps but not render it. Give your trackit.view.GoogleMaps view an xtype:
xtype: 'GoogleMaps'
Then render it as an item inside your trackit.view.trackMap view after your toolbar:
items: [
{
docked: 'top',
xtype: 'toolbar',
ui: "light",
title: 'Track direction',
},
{
xtype: 'GoogleMaps'
}
]
Related
I have a problem to integrate map in this view:
Ext.define('Sample.view.MainMenu', {
extend: 'Ext.tab.Panel',
requires: ['Ext.TitleBar','Ext.Video'],
alias: 'widget.mainmenuview',
config: {
tabBarPosition: 'bottom',
items: [
{
title: 'Welcome',
iconCls: 'home',
styleHtmlContent: true,
scrollable: true,
items: {
docked: 'top',
xtype: 'titlebar',
title: 'Welcome to sencha' ,items: [
{
xtype: 'button',
text: 'Log Off',
itemId: 'logOffButton',
align: 'right'
}
]
},
html: [
"Hello to dawini plateforme"
].join("")
},
{
title: 'Get Started',
iconCls: 'action',
items: [
{
docked: 'top',
xtype: 'titlebar',
title: 'Getting Started'
},
{
xtype: 'video',
url: 'http://av.vimeo.com/64284/137/87347327.mp4?token=1330978144_f9b698fea38cd408d52a2393240c896c',
posterUrl: 'http://b.vimeocdn.com/ts/261/062/261062119_640.jpg'
}
]
}
], listeners: [{
delegate: '#logOffButton',
event: 'tap',
fn: 'onLogOffButtonTap'
}]
},onLogOffButtonTap: function () {
this.fireEvent('onSignOffCommand');
}
});
Can someone help me how to integrate map in this view and think you very much.
I am a developer with SIMpalm (www.simpalm.com), and I think you should try map type in your Sencha component within the Items. Others attribute also can be configured like height, current location etc. And also you need to configure google map api in your Index.html page like, .
Example : items: [
{
xtype: 'map',
height: 200,
useCurrentLocation: true
}
]
Here you can find how to include map in Sencha Touch. Though it is focused on infobubble but it is also showing the map integration. Let me know if you have any difficulty implementing this.
Hi how i create a carousel with a toolbar, Would like to have the option to tap to switch views and also swipe to to switch views, here is my code , When I run this the xtypes inside the toolbar are not showing up in a toolbar ?
Thanks
Ext.define("NF.view.tablet.MainH", {
extend: 'Ext.tab.Panel',
requires: ['Ext.TitleBar'],
config: {
tabBar: {
hidden: true},
items: [
{
xtype : 'toolbar',
docked: 'top',
title: '',
layout:'hbox',
items:[
{xtype: 'home'} ,
{xtype:'tablet-placesContainer'},
{xtype:'tablet-About'},
{text: 'contact'},
{ xtype: 'contactpage'},
{xtype: 'home3'} ,
],
},
{
xtype:'carousel',
layout:'fit',
iconCls: 'home',
items:[
{xtype: 'home'} ,
{xtype:'tablet-placesContainer'},
{xtype:'tablet-About'},
{xtype: 'gallery'},
{ xtype: 'contactpage'},
{xtype: 'home3'} ,
]
}]
}
});
When I run this the toolbar info is not showing up.
I may be misunderstanding your question, but maybe your best bet is to
1) Make each toolbar item a simple button with html for the name of the carousel item
2) Give the carousel a name
3) just have a tap event for each toolbar item that sets the correct active item:
Ext.define("NF.view.tablet.MainH", {
extend: 'Ext.tab.Panel',
requires: ['Ext.TitleBar'],
config: {
tabBar: {
hidden: true},
items: [
{
xtype : 'toolbar',
docked: 'top',
title: '',
layout:'hbox',
items:[
{xtype:'button',text: 'home', handler:function(){Ext.getCmp('carousel_name').setActiveItem(0)}} ,
{xtype:'button',text: 'places', handler:function(){Ext.getCmp('carousel_name').setActiveItem(1)}} ,
],
},
{
xtype:'carousel',
id:'carousel_name',
layout:'fit',
iconCls: 'home',
items:[
{xtype: 'home'} ,
{xtype:'tablet-placesContainer'},
{xtype:'tablet-About'},
{xtype: 'gallery'},
{ xtype: 'contactpage'},
{xtype: 'home3'} ,
]
}]
}
For some reason my form panel isn't showing. Can anyone help? I'm a newbie so sorry if this is obvious! It was build with Sencha Architect but I can't understand why no fields are showing in the form?...
Ext.define('MyApp.view.Login', {
extend: 'Ext.Container',
config: {
layout: {
type: 'vbox'
},
items: [
{
xtype: 'titlebar',
docked: 'top',
title: 'My Title'
},
{
xtype: 'toolbar',
docked: 'top',
items: [
{
xtype: 'button',
text: 'Call'
},
{
xtype: 'button',
text: 'Email'
}
]
},
{
xtype: 'container',
flex: 1,
border: 2,
items: [
{
xtype: 'formpanel',
styleHtmlContent: true,
items: [
{
xtype: 'fieldset',
title: 'MyFieldSet',
items: [
{
xtype: 'textfield',
label: 'Field'
},
{
xtype: 'textfield',
label: 'Field'
}
]
}
]
}
]
}
]
}
});
To display formpanel (Ext.form.Panel) using Sencha Touch 2.3+ correctly inside other container you need to add scrollable: null property
{
xtype: 'formpanel',
scrollable: null,
items: [
...
]
}
See discussion here
Change the layout of your Login view from vbox to fit. Then set the layout of the container that contains your formpanel to fit also.
Check this link for more info about layouts in Sencha Touch.
I'm using Sencha Touch, at the moment I'm adding to the view some HTML code and underneath a button. I would like have the content of the HTML code together with the button to be in the centre of the screen.
Could you suggest me how to do it? thanks for your time
Ext.define('Project.view.SettingsSuccess', {
extend: 'Ext.Panel',
xtype: 'settingformsuccess',
config: {
title: 'Settings',
iconCls: 'info',
cls: 'settings-success',
scrollable: true,
styleHtmlContent: true,
items: [
{
xtype: 'titlebar',
docked: 'top',
title: 'Settings',
items: [
{
xtype: 'spacer'
},
{
text: 'Back',
ui: 'back'
}
]
},
{
html: [
'<p>You have successfully authorised.</p>'
].join("")
},
// Go to Dashboard Button
{
xtype:'button',
text: 'Visit your Home Page',
ui: 'normal'
}
]
}
});
Try that:
Pack the Html Content and the Button in a Container:
http://docs.sencha.com/ext-js/4-0/#/api/Ext.container.Container
Place the Container where you want, see the setPosition(..) Method:
http://docs.sencha.com/ext-js/4-0/source/Component3.html#Ext-Component-method-setPosition
I'm starting to play around with sencha touch 2 and ran into the following problem.
I'm trying to build a very simple application which has a listview and a tabpanel with a button :
I'm seeing the tabpanel with my button and nice title; but the listview refuses to show; i've tried adding 'layout: fit' but it's even worse.
What 'obvious' thing am I missing here ?
Main.js:
Ext.define('CurrencyFX.view.Main', {
extend: 'Ext.Panel',
requires: [
'CurrencyFX.view.Home',
'CurrencyFX.view.CurrencyList',
],
config: {
items: [
{ xtype: 'homecard' },
{ xtype: 'currencycard' },
]
}
});
Home.js:
Ext.define('CurrencyFX.view.Home', {
extend: 'Ext.Panel',
requires: ['Ext.TitleBar'],
xtype: 'homecard',
config: {
items: [{
docked: 'top',
xtype: 'titlebar',
title: 'Currency FX',
items: [
{
text: 'Refresh',
align: 'right',
action: 'reloadQuotes'
}
]
}
]
}
});
CurrencyList.js:
Ext.define('CurrencyFX.view.CurrencyList', {
extend: 'Ext.List',
requires: ['CurrencyFX.store.Currencies'],
xtype: 'currencycard',
config: {
itemTpl: '{name} is at {value}',
store: 'Currencies',
}
})
Can you add a height to the currencycard? This provides a quick check:
items: [
{ xtype: 'homecard'},
{ xtype: 'currencycard', height: 500 }
]
Here's a layout that will fill the screen (note that I moved docked: 'top' to here!!):
Ext.define('CurrencyFX.view.Main', {
extend: 'Ext.Panel',
requires: [
'CurrencyFX.view.Home',
'CurrencyFX.view.CurrencyList'
],
config: {
fullscreen: true,
layout: 'fit',
items: [
{
xtype: 'homecard',
docked: 'top'
},
{ xtype: 'currencycard'}
]
}
});