Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Using and Creating Visualforce Mobile Components

Alex Berg
September 19, 2012

Using and Creating Visualforce Mobile Components

My Dreamforce 2012 presentation as a Developer Zone breakout session.

Alex Berg

September 19, 2012
Tweet

More Decks by Alex Berg

Other Decks in Programming

Transcript

  1. Safe harbor Safe harbor statement under the Private Securities Litigation

    Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of intellectual property and other litigation, risks associated with possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-Q for the most recent fiscal quarter ended July 31, 2012. This documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward- looking statements.
  2. Project summary Force.com Labs project - released April '12 

    Library of new components  Framework for JS-rendered pages  Patterns reference
  3. Website user channels Various channels to access a website 

    Desktop • Heavy utilization and exploring  Mobile • Light utilization and quick info retrieval
  4. Project goal Why component library? Two mindsets  Salesforce =

    Clicks not Code  Mobile Apps = Code, code, code Bridge two worlds
  5. How do we use Mobile Components? Demo  List all

    Leads you follow on Chatter >  Link to Detail page >
  6. How does this work? Three main pieces  jQuery Mobile

    • Mobile view  Javascript Remoting • Data  Custom JS Framework • Render requested JQM page
  7. jQuery Mobile Great tool - let's dig deeper  Built-in

    complex views  listview • Example >
  8. Dynamic jQuery Mobile pages Two ways to build page with

    dynamic data  Build on server – Apex and VF  Build in browser – JS and HTML We want to build in browser  Feels more native
  9. Dynamic jQuery Mobile pages Two ways to build page with

    dynamic data  Visualforce-rendered page  But what does a JavaScript-rendered page look like? • Example >
  10. Dynamic jQuery Mobile pages Separate data source from static markup

     HTML-data list → JSON-data list and template  Let's see how to do this successfully • Example >
  11. Dynamic jQuery Mobile pages Insert into DOM  JQM embellishes

    HTML on document ready  Must instruct JQM to re-apply itself
  12. Dynamic jQuery Mobile pages Dynamic JQM pages are manual, but

    not too complex 1. Get data from server 2. Generate HTML fragment 3. Insert HTML into DOM 4. Tell JQM we updated
  13. Mobile Components for VF Framework Component  Purpose is to

    render HTML when requested • User requests page • Framework asks component for its HTML  Component is rooted in JavaScript  Component is JavaScript
  14. Mobile Components for VF Framework Component  Register Component •

    $V.App.registerComponent('{!$Component.list}', {!configAsJson});  Define JS controller • $V.ListComponent = $V.Component.extend({ /* Method definitions */});  $V.Component • this.$me – jQuery reference to component's root element • this.config – component constructor parameters • prepare and render methods
  15. Mobile Components for VF Framework App  $V.App methods •

    registerComponent – will instantiate JS controller when its page is requested  $V.App.log methods • info, debug, error  $V.App.config properties • user • fields
  16. Mobile Components for VF Framework Apex classes  BaseConfigController •

    Intended to be extended • Has 'config' property of 'BaseConfig' type  BaseConfig • Intended to be extended • elemId, jsCtlrName properties
  17. Mobile Components for VF Mobile Component solution composed of several

    files  VF Component holds HTML  JavaScript builds JQM page  Apex controller prepares data  Other resource files – JS library, JS templates, Apex helpers
  18. Mobile Components for VF Thumbnail list component 1. Root list

    element 2. Build HTML – get template and data Build Apex to pass data to JS 3. Insert HTML into root element 4. Re-apply JQM
  19. All about Sundog Sundog is a collaboration of marketing and

    technology experts that delivers measurable results with bold ideas, innovative implementation and enough coffee to convince you it’s Y3K. We’re passionate about our work and our fun. We challenge ourselves to think big and demonstrate the power and effectiveness of our creativity and innovation. Sundog is headquartered in Fargo, ND. We also have offices in Minneapolis and Denver and each location offers great people and great views. sundoginteractive.com