Upload
cfjedimaster
View
787
Download
0
Embed Size (px)
Citation preview
Adobe Spryfor the ColdFusion Guy
Raymond CamdenCamden Media, Inc
1
What is Spry?
• AJAX Framework developed by Adobe
• Free and Open Source
• Version 1.4 (Really 0.4)
• http://labs.adobe.com/technologies/spry
2
What is AJAX?
• Asynchronous JavaScript and XML
• Allows updates of web pages without posting or reloading page
• Relies on built in browser capabilities, doesn’t require plug-ins like Flash or ActiveX.
3
Capabilities
• Load and display data dynamically (no page reload)
• UI widgets (Tab, Accordion, Form, Panel)
• Visual Effects (Eye Candy)
• Miscellaneous
4
Limitations
• AJAX Limitations
• Requires JavaScript
• Performance
• Accessibility
• Browser Limitations
• Only supports XML data
5
How does Spry work?
• Include 2 JavaScript libraries
• xpath.js (Google xpath library)
• spryData.js (Main Spry Library)
• Other libraries for widgets and effects
• SpryAccordion.js (etc)
• SpryEffects.js
6
Data Set and Region
• Data Set is your remote XML data, filtered and order with XPath.
• Region is the area that Spry will “mark up” with your data.
8
Spry Regions
• Created using standard HTML (like a DIV)
• <div spry:region=”mydata”>
• Think of it like <CFOUTPUT>, it lets Spry know what areas will be updated.
• Items that can’t be regions: COL, COLGROUP, FRAMESET, HTML, IFRAME, STYLE, TABLE, TBODY, TFOOT, THEAD, TITLE, TR
11
Displaying Data
• Uses a binding notation similar to Flex
• {firstname}, or {@firstname}
• {mydata::firstname} (dataset name + column)
• Loop Construct
• <span spry:repeat=”mydata”>
• Can’t apply to all tags
13
Master/Detail
• Select Item from a list and show more information about it
• Use spry:detailregion
• Acts as a listener for changes for the current row
• Concept of current row
15
Sorting
• Sort method on dataset
• Parameter specifying the field name to sort on
• setColumnType for numeric or date data
• One way sorting unless toggle is specified
17
Other Data Features
• Notifications/Observers
• Paging and Filtering
• Conditionals (if/case)
• Behavior Attributes (hover/select)
• Automatic data refresh
19
Spry and ColdFusion
• Spry wants XML
• ColdFusion CFCs output WDDX
• How do we get them together??
20
Generating XML
• CFM “Proxy”
• CFC/returnType=“xml” (CF7 allows it)
• toXML.cfc
• http://ray.camdenfamily.com/projects/toxml
21