-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathevents.js
41 lines (33 loc) · 1.55 KB
/
events.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// observer functions
var dsEventsObserver = new Object;
dsEventsObserver.onPostLoad = function(dataSet, data)
{
mainContent.loadContent("spryevents_masterdetail.html", {id:"masterdetail"});
};
var mainContent;
var dsEvents;
Spry.Utils.addLoadListener(function()
{
// create dataset, add observer, and load data
dsEvents = new Spry.Data.HTMLDataSet(null, "mainContent", {hideDataSourceElement:false, firstRowAsHeaders:false, rowSelector:".event", dataSelector:".eventimage, h2, .location, .date, .description", columnNames:["eventimage","name","location","displaydate","description"]});
dsEvents.addObserver(dsEventsObserver);
dsEvents.loadData();
// create htmlpanel and add observer
mainContent = new Spry.Widget.HTMLPanel("mainContent");
var mainContentObserver = new Object;
mainContentObserver.onPostUpdate = function(dataSet, data)
{
// attach spry attributes to markup that was loaded into panel
Spry.$("masterbox").setAttribute('spry:region', 'dsEvents');
Spry.$("eventheader").setAttribute('spry:sort', 'date');
Spry.$("locationheader").setAttribute('spry:sort', 'location');
Spry.$("detailbox").setAttribute('spry:detailregion', 'dsEvents');
Spry.$$(".eventrow").setAttribute('spry:repeat', 'dsEvents');
Spry.$$(".eventrow").setAttribute('spry:hover', 'rowHover');
Spry.$$(".eventrow").setAttribute('spry:select', 'rowSelected');
Spry.$$(".eventrow").setAttribute('spry:setrow', 'dsEvents');
// now process the spry region (resolve data references)
Spry.Data.initRegions();
};
mainContent.addObserver(mainContentObserver);
});