]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | Ext.define('KitchenSink.view.dataview.MultiSortButton', {\r |
2 | extend: 'Ext.button.Button',\r | |
3 | xtype: 'dataview-multisort-sortbutton',\r | |
4 | \r | |
5 | config: {\r | |
6 | direction: "ASC",\r | |
7 | dataIndex: undefined\r | |
8 | },\r | |
9 | \r | |
10 | /**\r | |
11 | * @event changeDirection\r | |
12 | * Fired whenever the user clicks this button to change its direction\r | |
13 | * @param {String} direction The new direction (ASC or DESC)\r | |
14 | */\r | |
15 | handler: function() {\r | |
16 | this.toggleDirection();\r | |
17 | },\r | |
18 | \r | |
19 | /**\r | |
20 | * Updates the new direction of this button\r | |
21 | * @param {String} direction The new direction\r | |
22 | */\r | |
23 | updateDirection: function(direction) {\r | |
24 | this.setIconCls('sort-direction-' + direction.toLowerCase());\r | |
25 | this.fireEvent('changeDirection', this.getDirection());\r | |
26 | },\r | |
27 | \r | |
28 | /**\r | |
29 | * Toggles between ASC and DESC directions\r | |
30 | */\r | |
31 | toggleDirection: function() {\r | |
32 | this.setDirection(Ext.String.toggle(this.getDirection(), "ASC", "DESC"));\r | |
33 | }\r | |
34 | });\r |