Skip to content

Commit c70af46

Browse files
committed
#282 Covid.view.GalleryContainerController: onSortButtonClick() => adjusted to use data.component
1 parent c5544ae commit c70af46

2 files changed

Lines changed: 27 additions & 41 deletions

File tree

apps/covid/view/GalleryContainer.mjs

Lines changed: 23 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,7 @@ class GalleryContainer extends Container {
5353
flex : '0 1 auto',
5454
labelWidth : '110px',
5555
style : {padding: '10px'},
56-
useInputEvent: true,
57-
58-
listeners: {
59-
change: 'onRangefieldChange'
60-
}
56+
useInputEvent: true
6157
},
6258

6359
headers: [{
@@ -88,7 +84,10 @@ class GalleryContainer extends Container {
8884
maxValue : 1500,
8985
minValue : -1500,
9086
name : 'translateY',
91-
value : 0
87+
value : 0,
88+
listeners: {
89+
change: 'onRangefieldChange'
90+
}
9291
}, {
9392
labelText: 'Translate Z',
9493
maxValue : 550,
@@ -104,13 +103,15 @@ class GalleryContainer extends Container {
104103
maxValue : 15,
105104
minValue : 1,
106105
name : 'amountRows',
107-
value : 3
106+
value : 3,
107+
listeners: {
108+
change: 'onRangefieldChange'
109+
}
108110
}, {
109-
ntype : 'button',
110-
handler : 'onOrderButtonClick',
111-
text : 'Order by Row',
112-
listeners: {},
113-
style : {margin: '20px'}
111+
ntype : 'button',
112+
handler: 'onOrderButtonClick',
113+
text : 'Order by Row',
114+
style : {margin: '20px'}
114115
}, {
115116
ntype: 'label',
116117
text : 'Sort By:'
@@ -122,35 +123,17 @@ class GalleryContainer extends Container {
122123
ntype : 'container',
123124
layout: {ntype: 'vbox', align: 'stretch'},
124125
items : [{
125-
ntype : 'button',
126-
field : 'cases',
127-
handler : 'onSortButtonClick',
128-
text : 'Cases',
129-
listeners: {},
130-
style : {margin: '10px', marginTop: '0'},
131-
132-
/*domListeners: {
133-
click: function() {
134-
Neo.get('neo-gallery-1').store.sorters = [{
135-
property : 'cases',
136-
direction: 'DESC'
137-
}];
138-
}
139-
}*/
126+
ntype : 'button',
127+
field : 'cases',
128+
handler: 'onSortButtonClick',
129+
text : 'Cases',
130+
style : {margin: '10px', marginTop: '0'}
140131
}, {
141-
ntype : 'button',
142-
text : 'Deaths',
143-
listeners: {},
144-
style : {margin: '10px', marginBottom: '10px', marginTop: 0},
145-
146-
domListeners: {
147-
click: function() {
148-
Neo.get('neo-gallery-1').store.sorters = [{
149-
property : 'deaths',
150-
direction: 'DESC'
151-
}];
152-
}
153-
}
132+
ntype : 'button',
133+
field : 'deaths',
134+
handler: 'onSortButtonClick',
135+
text : 'Deaths',
136+
style : {margin: '10px', marginBottom: '10px', marginTop: 0}
154137
}, {
155138
ntype : 'button',
156139
text : 'Country',

apps/covid/view/GalleryContainerController.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ class GalleryContainerController extends ComponentController {
7070
* @param {Object} data
7171
*/
7272
onSortButtonClick(data) {
73-
console.log('onSortButtonClick', data);
73+
this.gallery.store.sorters = [{
74+
property : data.component.field,
75+
direction: 'DESC'
76+
}];
7477
}
7578

7679
/**

0 commit comments

Comments
 (0)