Build data-driven collection and list apps using ListView in HTML5

Slides:



Advertisements
Similar presentations
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Advertisements

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Windows 8 (1) (2) (3) Windows 8 (1) (2) (3)
Building Scalable Web Apps with Windows Azure Name Title Microsoft Corporation.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Feature: Purchase Requisitions - Requester © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
MIX 09 4/15/ :14 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Interactivity Navigating a data model Working with large quantities of data Entry Editing and adding data User feedback and validation Presentation.
Co- location Mass Market Managed Hosting ISV Hosting.
Announcing Demo Announcing.
Feature: SmartList Usability Enhancements © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
Session 1.
Built by Developers for Developers…. © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Assign an Item to Multiple Sites © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
demo Receive Inventory Export Parse and Normalize.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Building Social Games for Windows 8 with Windows Azure Name Title Microsoft Corporation.
Feature: Customer Combiner and Modifier © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
demo Instance AInstance B Read “7” Write “8”

customer.
demo © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
demo Demo.
demo QueryForeign KeyInstance /sm:body()/x:Order/x:Delivery/y:TrackingId1Z
Feature: Suggested Item Enhancements – Analysis and Assignment © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and.
Windows Azure SQL Data Sync Name Title Microsoft Corporation.
projekt202 © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks.
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.

S4 Solution Specialist Sales Summit
6/10/ :23 PM TOOL-504T A deep dive into Visual Studio 11 Express for designing Metro style apps using XAML Joanna Mason & Unni Ravindranathan Program.
Build data-driven collection and list apps using XAML
Manual testing of Windows Metro style apps built using HTML
Возможности Excel 2010, о которых следует знать
Reaching more customers with accessible Metro style apps using HTML5
Debugging your Metro style apps using HTML
Title of Presentation 11/22/2018 3:34 PM
Deep dive on app data roaming
Title of Presentation 12/2/2018 3:48 PM
Build /2/2018 © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
Using Windows Runtime and SDK to build Metro style apps
Search: integrating into the Windows 8 search experience
Build polished collection and list apps in HTML5
Customizing WPA Trace Views
Bring apps to life with Metro style animations in HTML5
File type associations and AutoPlay
1/3/2019 1:21 PM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Introduction to the new WPA user interface
Create rich, data-driven Web apps with ASP.NET 4.5 Web Forms
8/04/2019 9:13 PM © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
4/27/17, Bell #8 What amount of net pay has been earned this period?
Виктор Хаджийски Катедра “Металургия на желязото и металолеене”
Under the hood: Installation and updates for Metro style apps
From Start to REST in 60 Minutes (DEV323)
WINDOWS AZURE A LAP AROUND PLATFORM THE Steve Marx
PENSACOLA ENERGY WORK PLAN OCTOBER 10, 2016
Title of Presentation 5/12/ :53 PM
Шитманов Дархан Қаражанұлы Тарих пәнінің
The complete developer's guide to the SkyDrive API
Title of Presentation 5/24/2019 1:26 PM
5/24/2019 6:44 PM 1/8/18 Bell #10 In a world governed by the gods, is there any room for human will? Do human choices make a difference? EXPLAIN © 2007.
Using Smart Unit Tests to find bugs earlier in the development cycle
Title of Presentation 7/24/2019 8:53 PM
Bringing existing managed code into Metro style apps
Presentation transcript:

Build data-driven collection and list apps using ListView in HTML5 2/18/2019 2:40 PM APP-210T Build data-driven collection and list apps using ListView in HTML5 Sam Spencer Senior Program Manager Microsoft Corporation © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Agenda Using Data with ListView control How to bind a collection to in-memory data How to control the visuals of the data in the control How to edit the data so that the UI updates automatically How to tie in to other data sources such as cloud services

Collection controls in WinJS ListView Implements Windows 8 personality for lists Flip View Provides an item at a time view [APP-209T] – Build polished collection and list apps in HTML5

How to present a collection Data Renderer (Template) Control

demo Simple word game UI 2/18/2019 2:40 PM © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

How to present a collection Data Renderer (Template) Control

Array data source Data source for in-memory data Simple data source backed by a javascript array Supports full read/write capability with change notifications In memory so limited in size Keys for items can inferred using keyOf function option listview1.dataSource = new ArrayDataSource(array, { keyOf: function (item) { return item.ID; } });

Using the array data source 2/18/2019 2:40 PM demo Updating the word game Using the array data source © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

How to present a collection Data Renderer (Template) Control

Templates & data binding Re-usable generator of html defined in markup Use where you need to insert content programmatically Used to define how each list item will be presented Databinding Provides a crosslink between UI elements and data Synchronizes UI with changes to the data Binding converters enable customization of the binding logic [TOOL-501T] - Introducing the Windows Libraries for JavaScript LEARN MORE TOOL-501T - Introducing the Windows Libraries for JavaScript

Using a binding converter 2/18/2019 2:40 PM demo Updating the word game Using a binding converter © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Create, update & delete Getting the UI to update based on changes to the data

How to present a collection Data Renderer Control

How to present a collection Data Renderer Control

List data architecture Item Template Controls App logic List Data Source API Array Data source

ListDataSource API ListDataSource ListBinding getCount() insertAtEnd(key, data), insertBefore, … change(key, data) remove(string key) moveToStart(key), moveBefore, … beginEdits(), endEdits() createListBinding(notificationHandler) ListBinding fromKey(key) fromIndex(index)   jumpToItem(item) current() previous() next() releaseItem(item) release()

List data architecture Item Template Controls App logic Change notifications List Data Source API Array Data Source

How to insert a new data item Get the data source object Call insertAtEnd() method Passing a key (optional) Passing the data Insert operation is async, so it returns a promise

Using the datasource API to add an item 2/18/2019 2:40 PM demo Adding a new data item Using the datasource API to add an item © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Promises Object that is a promise for a value later Hook up to completion with then() method then(completion, error, progress) then() returns another promise Implementation in base.js: WinJS.Promise Common.js promises/A spec http://wiki.commonjs.org/wiki/Promises/A [TOOL-501T] Introducing the Windows Libraries for JavaScript

How to update a data item Get the key for the item if you don't already have it Use createListBinding() on the datasource to get a binding Call listbinding.fromIndex() method to get the item data fromIndex is async, so wait for the promise to complete Call change() on the item Change is async so also returns a promise

Changing an existing item 2/18/2019 2:40 PM demo Changing an existing item Using the datasource API to change an item © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Keys vs indices A B C D B E F G Editing operations require keys Indices of items are volatile The item key enables you to uniquely identify the item A B 1 C 2 D 3 B 1 E 4 F 5 G 6 Item at index #3

How to delete the selected items Convert the indices to a set of keys Use createListBinding() on the datasource to get a binding Call binding.fromIndex() method to get the item data Use promise.join() to wait for the set of promises to complete Start a batch for the changes with beginEdits() Delete the items using remove() End the batch with endEdits()

Deleting the selected items 2/18/2019 2:40 PM demo Deleting the selected items © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Listening for change notifications User code can also listen for change notifications Controls can make changes to data For example drag & drop in listview to rearrange items Items need to be flagged to receive notifications Required for scalability with large data sources

How to listen for notifications Create an object implementing the ListNotficationHandler contract inserted(), changed(), moved(), removed() methods Pass the object to createListBinding(handler) Register for notifications on specific items Request the item from the binding Call retain() on the item promise Release the binding when finished

Listening for notifications 2/18/2019 2:40 PM demo Listening for notifications © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Custom datasources API for interfacing to your own data

List data architecture Item Template Controls App logic List Data Source API Array Data Source Storage Data Source Custom Data Source [PLAT-892T] Building Great Gallery Experiences in Your App LEARN MORE PLAT-892T - Building Great Gallery Experiences in Your App

List data architecture Item Template Controls App logic List Data Source API Array Data Source Storage Data Source Custom Data Source

Custom data sources Cloud Data Source API Custom Data Source WinRT API Controls Cloud Data Source API Custom Data Source WinRT API

Word Game custom datasource Controls Hosted on Windows Azure Cloud WCF Data Service SQL Database Data Source API Custom Data Source

Using ListDataSource for custom data sources ListDataSource object simplifies creating a custom datasource It provides caching, change detection, data virtualization Acts as a wrapper around the ListDataAdapter contract ListDataAdapter is a simpler interface to implement Stateless, REST like Pay for Play ListDataSource API ListDataSource object Custom data source ListDataAdapter API Data Adapter object

How to create a custom data source Create an object for the data adapter Implement desired sub-set of ListDataAdapter API For example, a read-only index based adapter only requires: getCount() itemsFromIndex() Pass the adapter to ListDataSource constructor Use new object as the data source

Moving app data to Windows Azure 2/18/2019 2:40 PM demo Read only data adapter Moving app data to Windows Azure © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Pay for play datasource capability ListDataAdapter API itemsFromIndex getCount itemsFromKey itemsFromStart itemsFromEnd getCount insertAtEnd change remove insert…, move… AtStart Before After AtEnd Set-Notification-Handler Readonly Index based Readonly Key based Read-write No ordering Read-write + Ordering support Sending Change notifications

Pay for play datasource capability ListDataAdapter API itemsFromIndex getCount itemsFromKey itemsFromStart itemsFromEnd getCount insertAtEnd change remove insert…, move… AtStart Before After AtEnd Set-Notification-Handler Readonly Index based Readonly Key based Read-write No ordering Read-write + Ordering support Sending Change notifications

Read/write data adapter 2/18/2019 2:40 PM demo Read/write data adapter © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Diagnostic aids Promises will swallow exceptions Debug.enableFirstChanceExceptions(true); Use DOM explorer in Visual Studio Add logging to your datasource at beginning & end of methods Timing can be an issue for async methods Use console.log(string) to write to Visual Studio JS console

Review

List data architecture Item Template Controls App logic List Data Source API Array Data Source Storage Data Source Custom Data Source Source of data

List data architecture Item Template Controls App logic List Data Source API Array Data Source Storage Data Source Custom Data Source Source of data

List data architecture Item Template Controls App logic List Data Source API Array Data Source Storage Data Source Custom Data Source Source of data

For more information Related Sessions Documentation APP-209T – Build polished collection and list apps in HTML5 TOOL-501T – Introducing the Windows libraries for JavaScript PLAT-892T – Building Great Gallery Experiences in Your App APP-846T – Create reusable custom Metro style controls Documentation Adding ListView controls Accessing data and files (JavaScript) Metro style app Samples home Metro style app development forums Windows Dev Center home: http://msdn.microsoft.com/en-us/windows/

thank you Feedback and questions http://forums.dev.windows.com Session feedback http://bldw.in/SessionFeedback

© 2011 Microsoft Corporation. All rights reserved © 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.