]>
git.proxmox.com Git - extjs.git/blob - extjs/examples/modern/oreilly/app/controller/Sessions.js
1 Ext
.define('Oreilly.controller.Sessions', {
2 extend
: 'Ext.app.Controller',
12 sessionInfo
: 'sessionContainer sessionInfo',
13 sessionSpeakers
: 'sessionContainer list',
14 sessionContainer
: 'sessionContainer',
15 sessionDayPicker
: 'sessions segmentedbutton',
17 speakers
: 'sessionContainer speakers',
18 speakerInfo
: 'sessionContainer speakerInfo'
22 initialize
: 'initSessions',
23 itemtap
: 'onSessionTap',
24 activate
: 'onSessionsActivate'
27 toggle
: 'onSessionDateChange'
30 itemtap
: 'onSpeakerTap'
35 initSessions: function() {
36 var firstButton
= this.getSessionDayPicker().getItems().items
[0];
37 this.getSessionDayPicker().setPressedButtons(firstButton
);
38 this.filterByButton(firstButton
);
41 onSessionDateChange: function(seg
, btn
, toggle
) {
43 this.filterByButton(btn
);
47 filterByButton: function(btn
) {
48 if (this.getSessionSpeakers()) {
49 this.getSessionSpeakers().deselectAll();
51 Ext
.getStore('Sessions').clearFilter(true);
52 Ext
.getStore('Sessions').filter(function(record
) {
53 return record
.get('time').getDate() == btn
.config
.day
;
57 onSessionTap: function(list
, idx
, el
, record
) {
58 var speakerStore
= Ext
.getStore('SessionSpeakers'),
59 speakerIds
= record
.get('speakerIds');
61 speakerStore
.clearFilter(true);
62 speakerStore
.filterBy(function(speaker
) {
63 return Ext
.Array
.contains(speakerIds
, speaker
.get('id'));
67 this.session
= Ext
.widget('session');
70 this.session
.setTitle(record
.get('title'));
71 this.getSessionContainer().push(this.session
);
72 this.getSessionInfo().setRecord(record
);
75 onSpeakerTap: function(list
, idx
, el
, record
) {
76 if (!this.speakerInfo
) {
77 this.speakerInfo
= Ext
.widget('speakerInfo', {
78 scrollable
: 'vertical'
82 this.speakerInfo
.config
.title
= record
.getFullName();
83 this.speakerInfo
.setRecord(record
);
84 this.getSessionContainer().push(this.speakerInfo
);
87 onSessionsActivate: function() {
89 this.session
.down('speakers').deselectAll();