SlideShare uma empresa Scribd logo
1 de 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!

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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)
 

Semelhante a 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
 
Scaling with swagger
Scaling with swaggerScaling with swagger
Scaling with swaggerTony Tam
 
Pablo Villalba -
Pablo Villalba - Pablo Villalba -
Pablo Villalba - .toster
 

Semelhante a 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 -
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 

Último (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 

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)