1. create a project using city bars template in sencha architect

2. save your project name as CityBars

3. modify your controll code to:

Ext.define('CityBars.controller.Business', {
extend: 'Ext.app.Controller', config: {
refs: {
dataList: '#dataList',
listCard: '#listCard',
mainNav: 'mainnav',
detailCard: 'detailpanel'
}, control: {
"#dataList": {
itemtap: 'onListItemTap'
},
"detailpanel #callButton": {
tap: 'onCallButtonTap'
},
"detailpanel > map": {
activate: 'onMapActivate'
}
}
}, onListItemTap: function(dataview, index, target, record, e, eOpts) {
var map,
info,
details; if (record) {
details = Ext.create('CityBars.view.DetailPanel', {
title: 'Details'
}); // set the map
map = details.child('#detailMap');
map._record = record; // set the info
info = details.child('#contact').child('#info');
info.child('#photo').setData(record.data);
info.child('#data').setData(record.data); this.getMainNav().push(details);
}
}, onCallButtonTap: function(button, e, eOpts) { // TODO: Add custom phone call code here
window.location = 'tel:555-555-5555'; }, onMapActivate: function(newActiveItem, container, oldActiveItem, eOpts) {
var map = newActiveItem,
record = map._record,
lat = record.get('latitude'),
lng = record.get('longitude'),
centerMap = Ext.Function.createDelayed(function() {
map.setMapOptions({
zoom: 18
});
map.setMapCenter({
latitude: lat,
longitude: lng
});
}, 250),
geocoder, loc; if (lat && lng) {
centerMap();
} else {
geocoder = this._geocoder || (this._geocoder = new google.maps.Geocoder());
geocoder.geocode(
{address: [
record.get('address1'),
record.get('address2'),
record.get('address3'),
record.get('city'),
record.get('state_code'),
record.get('zip')
].join(', ')},
function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
loc = results[0].geometry.location;
lat = loc.lat();
lng = loc.lng();
record.set('latitude', lat);
record.set('longitude', lng);
centerMap();
} else {
Ext.Msg.alert("Could not find location: " + status);
}
}
);
} }, launch: function() { var me = this; // NOTE ABOUT YELP KEY
// You must use your own yelp key, available by registering (for free) with Yelp:
// http://www.yelp.com/developers/getting_started/api_overview
// (in this app, we use the Review Search API v1.0)
me.apiKey = '8UUJ-jfiOwttLyzTC56F6A'; // enter your own yelp key here // Get the location, then find businesses
Ext.Viewport.setMasked({ xtype: 'loadmask', message: 'Loading...' });
me.getLocation(function (location) { // then use Yelp to get the businesses
me.getBusinesses(location, function (store) { // then bind data to list and show it
me.getDataList().setStore(store); Ext.Viewport.setMasked(false); }); }); }, getLocation: function(callback) {
if (navigator && navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
callback(position);
}, function(error) {
// give a warning for error
});
}
}, getBusinesses: function(location, callback) { var store = Ext.data.StoreManager.lookup('BusinessStore'),
url = 'http://api.yelp.com/business_review_search' +
'?ywsid=' + this.apiKey +
'&term=Bars' +
'&lat=37.785834' + //location.coords.latitude +
'&long=-122.406417';// + location.coords.longitude;
store.getProxy().setUrl(url);
store.load(function() {
callback(store);
}); } });

4. run sencha cmd to launch your application on your web server

sencha fs web start -map /Users/user1/Documents/CityBars

5. visit your web using the url , which likes the following format:http://localhost:1841

how to run demo city bars using sencha architect的更多相关文章

  1. BZOJ1628: [Usaco2007 Demo]City skyline

    1628: [Usaco2007 Demo]City skyline Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 256  Solved: 210[Su ...

  2. Sencha Architect 安装与使用

    http://www.sencha.com/products/touch/ Sencha SDK Tools Advanced JavaScript and CSS Project Build Too ...

  3. SenchaTouch介绍和Sencha Architect介绍以及安装

    一.SenchaTouch介绍 Sencha Touch框架是世界上第一个基于HTML 5的Mobile App框架. 在Sencha Touch这个名词中,包括了两个组成部分,其中Sencha的前身 ...

  4. sencha architect/sencha touch , to prevent breakpoint lost when you debug

    add this to your loader config: Ext.Loader.setConfig({ disableCaching: false }); or : click 'applica ...

  5. 如何在版本控制工具中管理Sencha Architect的項目

    根據數次痛苦的經歷結合stack overflow上的解答,發現原來還是可以使用svn.git之類的版本控制工具管理Sencha Architect生成的項目的. 具體的要點如下,假定項目記作{PRO ...

  6. Sencha Architect 激活方法

     Sencha Architect 2是ExtJS和Sencha Touch的官方可视化IDE工具.最新版本是2.2,说是破解,其实是修改License来实现无限试用而已. 1.先下载安装官方软件,大 ...

  7. 简单破解 Sencha Architect 2.2 (ExtJs Designer)

    Sencha Architect 2是ExtJS和Sencha Touch的官方可视化IDE工具.最新版本是2.2,说是破解,其实是修改License来实现无限试用而已. 1.先下载安装官方软件,大约 ...

  8. Sencha Architect打开闪退问题修复

    删除以下位置的cache文件夹 C:\Users\Administrator\AppData\Local\Sencha\Sencha Architect 3.2\Cache bug解决参考 https ...

  9. 使用Sencha Architect开发Sencha Touch应用的整理

    官网:http://www.sencha.com/ 其实官网上的文档都很清楚了,不过整理一下总比较好 第一步,软件准备 注: 以下软件的安装本着这样两条原则 一是不要安装在中文目录下 二是不要安装在带 ...

随机推荐

  1. Forwarding a Range of Ports in VirtualBox

    STAN SCHWERTLY MAY 9, 2012 ARTICLES 3 COMMENTS Doesn't allow forwarding a range of ports through the ...

  2. 使用angular的ng-repeat遇到的一个问题

    问题描述:ng-repeat绑定的数据集动态更新之后其包裹的子元素所绑定的事件全部丢失:问题详述:问题代码如下: <style> img{width:100px;height:100px; ...

  3. 关于jQuery源码中(function(window,undefined){//dosomething()})(window)写法解释

    一.首先是最常见的闭包 (Closure) 范式自执行函数的写法,这里用匿名函数封装(构造块级作用域),避免了匿名函数内部的代码与外部之间发生冲突(如使用了相同的变量名). (function() { ...

  4. matlab norm 范式

    格式:n=norm(A,p) 功能:norm函数可计算几种不同类型的矩阵范数,根据p的不同可得到不同的范数 p  返回值  1  返回A中最大一列和,即max(sum(abs(A)))  2 返回A的 ...

  5. Ceph Newstore存储引擎介绍

    在Ceph被越来越多地应用于各项存储业务过程中,其性能及调优策略也成为用户密切关注讨论的话题,影响性能表现关键因素之一即OSD存储引擎实现:Ceph基础组件RADOS是强一致.对象存储系统,其OSD底 ...

  6. linux文件系统评估之inode

    存储系统上线前要做资源评估,通常需要在性能(即iops.带宽等)和容量维度进行业务评估:而具体到本地文件系统存储的容量时,需要根据具体业务对文件系统的可用数据空间和可用inode数进行评估,作者通过工 ...

  7. Unity3d 播放高质量视频解决方案

    Unity3d 播放高质量视频解决方案~ 最近在折腾一个视频游戏.真的是一个视频游戏,游戏主背景是个大视频.可能切换三四个视频,而且需要无缝切换. 平台是安卓,蕊片是rockclip.找了各式各样的插 ...

  8. Android——将图片加入到系统相册里面

    Adnroid中保存图片的方法可能有如下两种: 第一种是自己写方法,如下代码: public static File saveImage(Bitmap bmp) { File appDir = new ...

  9. war包编译和打包发布

    用IDE写一个基本的webApp 要学习java web技术,除了javaSE基本功之外,基础知识还有servlet技术.我们如果只用IDE的话,会把很多问题屏蔽掉,很多细节就想不清楚了.最好的方式, ...

  10. SharePoint 学习记事(三)

    做一件事情,计划很重要,但是变化会将一切的付出付诸东流. 13年年底,领导想要调整资源,准备启动项目.于是我们召开了一个类似于启动会的资源筹备会.(处于低成本的考虑,部门领导想要共享日本组的两个做.n ...