SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Alloy + Backbone.js =
AWESOME!!!!!!!!!!!!
• Owner of Eccra Solutions, LLC.
• 15 years experience in development/consulting
• Specialize in Mobile Development
• Focusing on Ruby on Rails, Appcelerator, Objective C, Java, & NodeJs
• Member of the Appcelerator Titan Program & TCAD
• Loves Indie Music, Food and the Reds (Liverpool & Cincinnati)
• Twitter: @Eccra
• URL: www.eccra.com
• GitHub: bradenpowers
Who am I?
Backbone.js gives structure to web applications by
providing models with key-value binding and custom
events, collections with a rich API of enumerable
functions,views with declarative event handling, and
connects it all to your existing API over a RESTful JSON
interface.
What is Backbone?
Wait a minute
• This is a mobile app, not a web app. How do we use it?
• Don’t worry...It is cooked into Alloy
How do I get started?
CreateYour Model
Presto...Your Model is Created!
exports.definition = {
config: {
columns: {
"city": "string",
"name": "string"
},
adapter: {
type: "sql",
collection_name: "baseball"
}
},
extendModel: function(Model) {
_.extend(Model.prototype, {
// extended functions and properties go
here
});
return Model;
},
extendCollection: function(Collection) {
_.extend(Collection.prototype, {
// extended functions and properties go
here
});
return Collection;
}
What If I Have A Database That I
Want To Use?
exports.definition = {
config: {
"adapter": {
"type": "sql",
"collection_name": "baseball",
"db_file": "/baseball.sqlite",
"idAttribute": "id",
"remoteBackup": false
}
},
extendModel: function(Model) {
_.extend(Model.prototype, {
// extended functions and properties go
here
});
return Model;
},
extendCollection: function(Collection) {
_.extend(Collection.prototype, {
// extended functions and properties go
here
});
return Collection;
}
}
What If I Have A REST API That
I Want To Use?
exports.definition = {
config: {
adapter: {
type: "baseball_rest",
collection_name: "baseball",
base_url: 'YourURL/baseball'
}
},
extendModel: function(Model) {
// Mongo uses _id as the model ID
_.extend(Model.prototype, {
idAttribute: '_id'
});
return Model;
}
}
* Please note that you have to build your own REST API for this to work! That is a
ton of fun and I don’t have enough time to talk about it here.
So...How Do I Use My Model?
MAGIC!! (not really)
EditYour Alloy.js File SoYou Can
Use It Globally!
Alloy.Collections.baseball = Alloy.createCollection('baseball');
Time to Edit the Index.js File To
Grab that Data!
var teams = Alloy.Collections.baseball;
teams.fetch();
$.index.open();
What is that “fetch thing? “ Fetch is what is used to bind the collection to the
TableView.
Now Let’s Edit the
View...Index.xml
<Alloy>
<Window class="container">
<TableView id="table" dataCollection="baseball">
<Require src="row"></Require>
</TableView>
</Window>
</Alloy>
How Does The Data Get Into
The TableView?
The Use Of BackBone Sync
Adapters
• FOR A COLLECTION
• FETCH - Grabs the Data
• CREATE - New or Updates
• DESTROY - Deletes
• FOR A MODEL
• FETCH - Grabs the Data
• SAVE - New or Updates
• DESTROY - Deletes
What Else Can I Do With Sync
Adapters?
• Custom Sync Adapter (for your REST API)
• Queries for the SQL Adapter
• Migrations (SQL only)
OK...Back To The Program...How
Is That Data Getting Into the
TableView?
Time To Create the Row.xml
That We Required in Index.Xml
<Alloy>
<TableViewRow>
<Label id="city" text="{city}"/>
<Label id="name" text="{name}"/>
</TableViewRow>
</Alloy>
The data in the { } is the data bound from
the collection.
Time To Edit The Row
Controller...Row.js
if ($model) {
$.row.model = $model.toJSON();
}
So When I Finally Run the Code
I See This!
OK...That Is Awesome...What If
I Want to Add Another Team?
function addBaseBallTeam(e) {
var model = Alloy.createModel('baseball', {
city: $.cityText.value,
name: $.nameText.value
});
// add model to the collection and save it to sqlite and then
refresh the data
team.add(model);
model.save();
team.fetch();
}
Now What? What Else Is There?
• Data Binding - Filtering
• Extending Backbone (likeValidation)
Thanks!

Weitere ähnliche Inhalte

Was ist angesagt?

Testing AngularJS
Testing AngularJSTesting AngularJS
Testing AngularJSKyle Hodgson
 
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...SĂ©bastien Levert
 
Ext Web Components - Dev Week 2019
Ext Web Components - Dev Week 2019Ext Web Components - Dev Week 2019
Ext Web Components - Dev Week 2019Sandeep Adwankar
 
Creating BananaJS with Angular 2, Angular CLI, and Material Design
Creating BananaJS with Angular 2, Angular CLI, and Material DesignCreating BananaJS with Angular 2, Angular CLI, and Material Design
Creating BananaJS with Angular 2, Angular CLI, and Material DesignTracy Lee
 
The Tale of 2 CLIs - Ember-cli and Angular-cli
The Tale of 2 CLIs - Ember-cli and Angular-cliThe Tale of 2 CLIs - Ember-cli and Angular-cli
The Tale of 2 CLIs - Ember-cli and Angular-cliTracy Lee
 
Getting Started with the Angular 2 CLI
Getting Started with the Angular 2 CLIGetting Started with the Angular 2 CLI
Getting Started with the Angular 2 CLIJim Lynch
 
Orgchart for Alfresco lightning talk
Orgchart for Alfresco lightning talkOrgchart for Alfresco lightning talk
Orgchart for Alfresco lightning talkITD Systems
 
Alloy Simple App Demonstration
Alloy Simple App DemonstrationAlloy Simple App Demonstration
Alloy Simple App DemonstrationAaron Saunders
 
Appcelerator Titanium Alloy
Appcelerator Titanium Alloy Appcelerator Titanium Alloy
Appcelerator Titanium Alloy karthi-anubavam
 
Creating an Angular 2 Angular CLI app in 15 Minutes Using MaterializeCSS & Fi...
Creating an Angular 2 Angular CLI app in 15 Minutes Using MaterializeCSS & Fi...Creating an Angular 2 Angular CLI app in 15 Minutes Using MaterializeCSS & Fi...
Creating an Angular 2 Angular CLI app in 15 Minutes Using MaterializeCSS & Fi...Tracy Lee
 
Angular2 + Ng-Lightning + Lightning Design System = Great Apps
Angular2 + Ng-Lightning + Lightning Design System = Great AppsAngular2 + Ng-Lightning + Lightning Design System = Great Apps
Angular2 + Ng-Lightning + Lightning Design System = Great AppsEmily Hurn
 
Using Angular-CLI to Deploy an Angular 2 App Using Firebase in 30 Minutes
Using Angular-CLI to Deploy an Angular 2 App Using Firebase in 30 MinutesUsing Angular-CLI to Deploy an Angular 2 App Using Firebase in 30 Minutes
Using Angular-CLI to Deploy an Angular 2 App Using Firebase in 30 MinutesTracy Lee
 
Angular elements - embed your angular components EVERYWHERE
Angular elements - embed your angular components EVERYWHEREAngular elements - embed your angular components EVERYWHERE
Angular elements - embed your angular components EVERYWHERENadav Mary
 
Get Hip with Java Hipster - JavaOne 2017
Get Hip with Java Hipster - JavaOne 2017Get Hip with Java Hipster - JavaOne 2017
Get Hip with Java Hipster - JavaOne 2017Matt Raible
 
Why you should add React to your Rails application now!
Why you should add React to your Rails application now!Why you should add React to your Rails application now!
Why you should add React to your Rails application now!David Roberts
 
How to create an angular 2.0 application in liferay dxp to fetch the ootb adv...
How to create an angular 2.0 application in liferay dxp to fetch the ootb adv...How to create an angular 2.0 application in liferay dxp to fetch the ootb adv...
How to create an angular 2.0 application in liferay dxp to fetch the ootb adv...Azilen Technologies Pvt. Ltd.
 
Develop Hip APIs and Apps with Spring Boot and Angular - Connect.Tech 2017
 Develop Hip APIs and Apps with Spring Boot and Angular - Connect.Tech 2017 Develop Hip APIs and Apps with Spring Boot and Angular - Connect.Tech 2017
Develop Hip APIs and Apps with Spring Boot and Angular - Connect.Tech 2017Matt Raible
 
Java spring mysql without hibernate(2) (1)
Java spring mysql without hibernate(2) (1)Java spring mysql without hibernate(2) (1)
Java spring mysql without hibernate(2) (1)AmedJacobReza
 

Was ist angesagt? (20)

Testing AngularJS
Testing AngularJSTesting AngularJS
Testing AngularJS
 
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...
 
Rails for Django developers
Rails for Django developersRails for Django developers
Rails for Django developers
 
Ext Web Components - Dev Week 2019
Ext Web Components - Dev Week 2019Ext Web Components - Dev Week 2019
Ext Web Components - Dev Week 2019
 
Creating BananaJS with Angular 2, Angular CLI, and Material Design
Creating BananaJS with Angular 2, Angular CLI, and Material DesignCreating BananaJS with Angular 2, Angular CLI, and Material Design
Creating BananaJS with Angular 2, Angular CLI, and Material Design
 
The Tale of 2 CLIs - Ember-cli and Angular-cli
The Tale of 2 CLIs - Ember-cli and Angular-cliThe Tale of 2 CLIs - Ember-cli and Angular-cli
The Tale of 2 CLIs - Ember-cli and Angular-cli
 
Getting Started with the Angular 2 CLI
Getting Started with the Angular 2 CLIGetting Started with the Angular 2 CLI
Getting Started with the Angular 2 CLI
 
Orgchart for Alfresco lightning talk
Orgchart for Alfresco lightning talkOrgchart for Alfresco lightning talk
Orgchart for Alfresco lightning talk
 
Micro frontend
Micro frontendMicro frontend
Micro frontend
 
Alloy Simple App Demonstration
Alloy Simple App DemonstrationAlloy Simple App Demonstration
Alloy Simple App Demonstration
 
Appcelerator Titanium Alloy
Appcelerator Titanium Alloy Appcelerator Titanium Alloy
Appcelerator Titanium Alloy
 
Creating an Angular 2 Angular CLI app in 15 Minutes Using MaterializeCSS & Fi...
Creating an Angular 2 Angular CLI app in 15 Minutes Using MaterializeCSS & Fi...Creating an Angular 2 Angular CLI app in 15 Minutes Using MaterializeCSS & Fi...
Creating an Angular 2 Angular CLI app in 15 Minutes Using MaterializeCSS & Fi...
 
Angular2 + Ng-Lightning + Lightning Design System = Great Apps
Angular2 + Ng-Lightning + Lightning Design System = Great AppsAngular2 + Ng-Lightning + Lightning Design System = Great Apps
Angular2 + Ng-Lightning + Lightning Design System = Great Apps
 
Using Angular-CLI to Deploy an Angular 2 App Using Firebase in 30 Minutes
Using Angular-CLI to Deploy an Angular 2 App Using Firebase in 30 MinutesUsing Angular-CLI to Deploy an Angular 2 App Using Firebase in 30 Minutes
Using Angular-CLI to Deploy an Angular 2 App Using Firebase in 30 Minutes
 
Angular elements - embed your angular components EVERYWHERE
Angular elements - embed your angular components EVERYWHEREAngular elements - embed your angular components EVERYWHERE
Angular elements - embed your angular components EVERYWHERE
 
Get Hip with Java Hipster - JavaOne 2017
Get Hip with Java Hipster - JavaOne 2017Get Hip with Java Hipster - JavaOne 2017
Get Hip with Java Hipster - JavaOne 2017
 
Why you should add React to your Rails application now!
Why you should add React to your Rails application now!Why you should add React to your Rails application now!
Why you should add React to your Rails application now!
 
How to create an angular 2.0 application in liferay dxp to fetch the ootb adv...
How to create an angular 2.0 application in liferay dxp to fetch the ootb adv...How to create an angular 2.0 application in liferay dxp to fetch the ootb adv...
How to create an angular 2.0 application in liferay dxp to fetch the ootb adv...
 
Develop Hip APIs and Apps with Spring Boot and Angular - Connect.Tech 2017
 Develop Hip APIs and Apps with Spring Boot and Angular - Connect.Tech 2017 Develop Hip APIs and Apps with Spring Boot and Angular - Connect.Tech 2017
Develop Hip APIs and Apps with Spring Boot and Angular - Connect.Tech 2017
 
Java spring mysql without hibernate(2) (1)
Java spring mysql without hibernate(2) (1)Java spring mysql without hibernate(2) (1)
Java spring mysql without hibernate(2) (1)
 

Ă„hnlich wie Alloy backbone

Riding the Edge with Ember.js
Riding the Edge with Ember.jsRiding the Edge with Ember.js
Riding the Edge with Ember.jsaortbals
 
Introduction to Ember.js and how we used it at FlowPro.io
Introduction to Ember.js and how we used it at FlowPro.ioIntroduction to Ember.js and how we used it at FlowPro.io
Introduction to Ember.js and how we used it at FlowPro.ioPaul Knittel
 
Intro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate JavascriptIntro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate JavascriptAndrew Lovett-Barron
 
Backbonification for dummies - Arrrrug 10/1/2012
Backbonification for dummies - Arrrrug 10/1/2012Backbonification for dummies - Arrrrug 10/1/2012
Backbonification for dummies - Arrrrug 10/1/2012Dimitri de Putte
 
Web Development using Ruby on Rails
Web Development using Ruby on RailsWeb Development using Ruby on Rails
Web Development using Ruby on RailsAvi Kedar
 
From Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) AgainFrom Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) Againjonknapp
 
Azure Functions Real World Examples
Azure Functions Real World Examples Azure Functions Real World Examples
Azure Functions Real World Examples Yochay Kiriaty
 
Core Data in RubyMotion #inspect
Core Data in RubyMotion #inspectCore Data in RubyMotion #inspect
Core Data in RubyMotion #inspectLori Olson
 
Building a Single Page Application with VueJS
Building a Single Page Application with VueJSBuilding a Single Page Application with VueJS
Building a Single Page Application with VueJSdanpastori
 
Boosting Your Productivity, with Backbone & RactiveJS
Boosting Your Productivity, with Backbone & RactiveJS Boosting Your Productivity, with Backbone & RactiveJS
Boosting Your Productivity, with Backbone & RactiveJS Gabriel Gottgtroy Zigolis
 
Get Hip with JHipster - Colorado Springs Open Source User Group 2021
Get Hip with JHipster - Colorado Springs Open Source User Group 2021Get Hip with JHipster - Colorado Springs Open Source User Group 2021
Get Hip with JHipster - Colorado Springs Open Source User Group 2021Matt Raible
 
Rails Vs CakePHP
Rails Vs CakePHPRails Vs CakePHP
Rails Vs CakePHPGautam Rege
 
Play Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level OverviewPlay Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level OverviewJosh Padnick
 
Intro to Rails
Intro to RailsIntro to Rails
Intro to Railslvrubygroup
 
frontend-161011205424.pptx
frontend-161011205424.pptxfrontend-161011205424.pptx
frontend-161011205424.pptxABHISHEKJHA176786
 
Scaling with swagger
Scaling with swaggerScaling with swagger
Scaling with swaggerTony Tam
 
Pablo Villalba -
Pablo Villalba - Pablo Villalba -
Pablo Villalba - .toster
 

Ă„hnlich wie Alloy backbone (20)

Riding the Edge with Ember.js
Riding the Edge with Ember.jsRiding the Edge with Ember.js
Riding the Edge with Ember.js
 
Introduction to Ember.js and how we used it at FlowPro.io
Introduction to Ember.js and how we used it at FlowPro.ioIntroduction to Ember.js and how we used it at FlowPro.io
Introduction to Ember.js and how we used it at FlowPro.io
 
Intro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate JavascriptIntro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate Javascript
 
Backbonification for dummies - Arrrrug 10/1/2012
Backbonification for dummies - Arrrrug 10/1/2012Backbonification for dummies - Arrrrug 10/1/2012
Backbonification for dummies - Arrrrug 10/1/2012
 
Web Development using Ruby on Rails
Web Development using Ruby on RailsWeb Development using Ruby on Rails
Web Development using Ruby on Rails
 
From Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) AgainFrom Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) Again
 
Azure Functions Real World Examples
Azure Functions Real World Examples Azure Functions Real World Examples
Azure Functions Real World Examples
 
Core Data in RubyMotion #inspect
Core Data in RubyMotion #inspectCore Data in RubyMotion #inspect
Core Data in RubyMotion #inspect
 
Building a Single Page Application with VueJS
Building a Single Page Application with VueJSBuilding a Single Page Application with VueJS
Building a Single Page Application with VueJS
 
Boosting Your Productivity, with Backbone & RactiveJS
Boosting Your Productivity, with Backbone & RactiveJS Boosting Your Productivity, with Backbone & RactiveJS
Boosting Your Productivity, with Backbone & RactiveJS
 
Get Hip with JHipster - Colorado Springs Open Source User Group 2021
Get Hip with JHipster - Colorado Springs Open Source User Group 2021Get Hip with JHipster - Colorado Springs Open Source User Group 2021
Get Hip with JHipster - Colorado Springs Open Source User Group 2021
 
Rails Vs CakePHP
Rails Vs CakePHPRails Vs CakePHP
Rails Vs CakePHP
 
Mobile native-hacks
Mobile native-hacksMobile native-hacks
Mobile native-hacks
 
Play Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level OverviewPlay Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level Overview
 
Angular js
Angular jsAngular js
Angular js
 
Intro to Rails
Intro to RailsIntro to Rails
Intro to Rails
 
frontend-161011205424.pptx
frontend-161011205424.pptxfrontend-161011205424.pptx
frontend-161011205424.pptx
 
Oracle APEX Nitro
Oracle APEX NitroOracle APEX Nitro
Oracle APEX Nitro
 
Scaling with swagger
Scaling with swaggerScaling with swagger
Scaling with swagger
 
Pablo Villalba -
Pablo Villalba - Pablo Villalba -
Pablo Villalba -
 

KĂĽrzlich hochgeladen

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 

KĂĽrzlich hochgeladen (20)

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

Alloy backbone

  • 1. Alloy + Backbone.js = AWESOME!!!!!!!!!!!!
  • 2. • Owner of Eccra Solutions, LLC. • 15 years experience in development/consulting • Specialize in Mobile Development • Focusing on Ruby on Rails, Appcelerator, Objective C, Java, & NodeJs • Member of the Appcelerator Titan Program & TCAD • Loves Indie Music, Food and the Reds (Liverpool & Cincinnati) • Twitter: @Eccra • URL: www.eccra.com • GitHub: bradenpowers Who am I?
  • 3. Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions,views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface. What is Backbone?
  • 4. Wait a minute • This is a mobile app, not a web app. How do we use it? • Don’t worry...It is cooked into Alloy
  • 5. How do I get started?
  • 7. Presto...Your Model is Created! exports.definition = { config: { columns: { "city": "string", "name": "string" }, adapter: { type: "sql", collection_name: "baseball" } }, extendModel: function(Model) { _.extend(Model.prototype, { // extended functions and properties go here }); return Model; }, extendCollection: function(Collection) { _.extend(Collection.prototype, { // extended functions and properties go here }); return Collection; }
  • 8. What If I Have A Database That I Want To Use? exports.definition = { config: { "adapter": { "type": "sql", "collection_name": "baseball", "db_file": "/baseball.sqlite", "idAttribute": "id", "remoteBackup": false } }, extendModel: function(Model) { _.extend(Model.prototype, { // extended functions and properties go here }); return Model; }, extendCollection: function(Collection) { _.extend(Collection.prototype, { // extended functions and properties go here }); return Collection; } }
  • 9. What If I Have A REST API That I Want To Use? exports.definition = { config: { adapter: { type: "baseball_rest", collection_name: "baseball", base_url: 'YourURL/baseball' } }, extendModel: function(Model) { // Mongo uses _id as the model ID _.extend(Model.prototype, { idAttribute: '_id' }); return Model; } } * Please note that you have to build your own REST API for this to work! That is a ton of fun and I don’t have enough time to talk about it here.
  • 10. So...How Do I Use My Model? MAGIC!! (not really)
  • 11. EditYour Alloy.js File SoYou Can Use It Globally! Alloy.Collections.baseball = Alloy.createCollection('baseball');
  • 12. Time to Edit the Index.js File To Grab that Data! var teams = Alloy.Collections.baseball; teams.fetch(); $.index.open(); What is that “fetch thing? “ Fetch is what is used to bind the collection to the TableView.
  • 13. Now Let’s Edit the View...Index.xml <Alloy> <Window class="container"> <TableView id="table" dataCollection="baseball"> <Require src="row"></Require> </TableView> </Window> </Alloy> How Does The Data Get Into The TableView?
  • 14. The Use Of BackBone Sync Adapters • FOR A COLLECTION • FETCH - Grabs the Data • CREATE - New or Updates • DESTROY - Deletes • FOR A MODEL • FETCH - Grabs the Data • SAVE - New or Updates • DESTROY - Deletes
  • 15. What Else Can I Do With Sync Adapters? • Custom Sync Adapter (for your REST API) • Queries for the SQL Adapter • Migrations (SQL only)
  • 16. OK...Back To The Program...How Is That Data Getting Into the TableView?
  • 17. Time To Create the Row.xml That We Required in Index.Xml <Alloy> <TableViewRow> <Label id="city" text="{city}"/> <Label id="name" text="{name}"/> </TableViewRow> </Alloy> The data in the { } is the data bound from the collection.
  • 18. Time To Edit The Row Controller...Row.js if ($model) { $.row.model = $model.toJSON(); }
  • 19. So When I Finally Run the Code I See This!
  • 20. OK...That Is Awesome...What If I Want to Add Another Team? function addBaseBallTeam(e) { var model = Alloy.createModel('baseball', { city: $.cityText.value, name: $.nameText.value }); // add model to the collection and save it to sqlite and then refresh the data team.add(model); model.save(); team.fetch(); }
  • 21. Now What? What Else Is There? • Data Binding - Filtering • Extending Backbone (likeValidation)