37
Intro to Sencha Touch Lichtsoft – October 29 th 2011

Intro to sencha touch

Embed Size (px)

DESCRIPTION

Introduction to Sencha Touch, some people said it is one of the best mobile web framework. Some people didn't say that though.. well this is democracy :D

Citation preview

Page 1: Intro to sencha touch

Intro to Sencha TouchLichtsoft – October 29th 2011

Page 2: Intro to sencha touch

HTML 5 in Mobile Web

Why?

Rich & more interactive experience for mobile devices

Page 3: Intro to sencha touch

Known Mobile Web (HTML 5)Frameworks

Page 4: Intro to sencha touch

Frameworks

Page 5: Intro to sencha touch

Frameworks

Page 6: Intro to sencha touch

Frameworks

Page 7: Intro to sencha touch
Page 8: Intro to sencha touch

Starting 1. Download Sencha Touch SDK

http://www.sencha.com/products/touch/download

2. Start Web Server3. Web Browser

▫Safari▫Chrome

Page 9: Intro to sencha touch

Starting

4. Unzip SDK

Page 10: Intro to sencha touch

Starting5. Test on Device

Page 11: Intro to sencha touch

Starting

Page 12: Intro to sencha touch

Starting•open the httpd-xampp.conf file, probably

in C:\xampp\apache\conf\extra find:

•change to Allow from all

<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))"> Order deny,allow Deny from all Allow from 127.0.0.0/8 ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var</LocationMatch>

Page 13: Intro to sencha touch

Create Your First Application

Page 14: Intro to sencha touch

Creating Application•Folder Structure

Page 15: Intro to sencha touch

Creating Application•Index.html<!DOCTYPE html><html> <head> <title>Hello World</title> <script src="lib/touch/sencha-touch.js" type="text/javascript"></script> <script src="app/app.js" type="text/javascript"> </script> <link href="lib/touch/resources/css/sencha-touch.css"

rel="stylesheet" type="text/css" /> </head> <body></body></html>

Page 16: Intro to sencha touch

Creating Application•app.js

new Ext.Application({ launch: function() { new Ext.Panel({ fullscreen: true, dockedItems: [{xtype:'toolbar', title:'My First App'}], layout: 'fit', styleHtmlContent: true, html: '<h2>Hello World!</h2>I did it!' }); }});

Page 17: Intro to sencha touch

Creating Application

Page 18: Intro to sencha touch

Creating Application

Page 19: Intro to sencha touch

List Component

Page 20: Intro to sencha touch

Data StoreExt.regModel('Contact', {

fields: ['firstName', 'lastName']});

ListDemo.ListStore = new Ext.data.Store({ model: 'Contact', sorters: 'firstName', getGroupString: function(record) { return record.get('firstName')[0]; }, data: [

{ firstName: "Azby", lastName: "Luthfan" },{ firstName: "Yosef", lastName: "Sukianto"},{ firstName: "Brian", lastName: "Al Bahr" },{ firstName: "Chandra", lastName: "Sutikno"} ,

],});

Page 21: Intro to sencha touch

Using the Data StoreListDemo = new Ext.Application({ name: "ListDemo",

launch: function(){ ListDemo.listPanel = new Ext.List({ id: 'indexList', store: ListDemo.ListStore, itemTpl:

'<div class="contact">{firstName}&nbsp;{lastName}</div>', });

ListDemo.Viewport = new Ext.Panel({fullscreen: true,layout: 'fit',items: [ListDemo.listPanel],

}); }});

Page 22: Intro to sencha touch

List with Data Store

Page 23: Intro to sencha touch

Grouping List

ListDemo.listPanel = new Ext.List({ id: 'indexList', store: ListDemo.ListStore, itemTpl: '<div class="contact">{firstName}&nbsp;{lastName}</div>', grouped: true, indexBar: true,});

Page 24: Intro to sencha touch

Grouping List

Page 25: Intro to sencha touch

Adding Detail PageListDemo.detailPanel = new Ext.Panel({

id: 'detailPanel',tpl: 'Hello, {firstName}',

}); ListDemo.Viewport = new Ext.Panel({

fullscreen: true,layout: 'card',items: [ListDemo.listPanel, ListDemo.detailPanel],

});

Page 26: Intro to sencha touch

Adding Detail PageListDemo.listPanel = new Ext.List({ id: 'indexList', store: ListDemo.ListStore, itemTpl: '<div class="contact">{firstName}&nbsp;{lastName}</div>', grouped: true, indexBar: true,

onItemDisclosure: function(record){ ListDemo.detailPanel.update(record.data); ListDemo.Viewport.setActiveItem('detailPanel'); },});

Page 27: Intro to sencha touch

List with Detail Page

Page 28: Intro to sencha touch

List with Detail Page

when detail button touched

Page 29: Intro to sencha touch

Adding ToolbarListDemo.detailToolbar = new Ext.Toolbar({ items: [ { text: 'back', ui: 'back', handler: function() {

ListDemo.Viewport.setActiveItem('indexList'); }]});

ListDemo.detailPanel = new Ext.Panel({ id: 'detailPanel', tpl: 'Hello, {firstName}', dockedItems: [ListDemo.detailToolbar],});

Page 30: Intro to sencha touch

Toolbar

Page 31: Intro to sencha touch

Mobile Web vs Mobile App

Page 32: Intro to sencha touch

Pros:•No need to develop in multiple platform

Mobile Web vs Mobile App

Page 33: Intro to sencha touch

Mobile Web vs Mobile App

Cons:•Mobile web can’t use device features like

Accelerometer, Camera, Compass, etc•Animations in mobile web are sometimes

inconsistent•Slower

Page 34: Intro to sencha touch

Titanium Mobile

Page 35: Intro to sencha touch

PhoneGap

Page 36: Intro to sencha touch

PhoneGap•Multi-platform

Page 37: Intro to sencha touch

Thank You