3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
16 * @class Ext.multisort.Panel
17 * @extends Ext.panel.Panel
22 Ext.define('Ext.multisort.Panel', {
23 extend: 'Ext.panel.Panel',
27 title: 'Multisort DataView',
30 requires: ['Ext.toolbar.TextItem', 'Ext.view.View'],
32 initComponent: function() {
33 this.tbar = Ext.create('Ext.toolbar.Toolbar', {
34 plugins : Ext.create('Ext.ux.BoxReorderer', {
38 this.down('dataview').store.sort(this.getSorters());
45 changeDirection: this.updateStoreSorters
50 text: 'Sort on these fields:',
68 (!Ext.isIE6? '<img src="../../datasets/touch-icons/{thumb}" />' :
69 '<div style="position:relative;width:74px;height:74px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'../../datasets/touch-icons/{thumb}\')"></div>'),
74 plugins: [Ext.create('Ext.ux.DataView.Animated')],
75 itemSelector: 'div.item',
76 store: Ext.create('Ext.data.Store', {
80 fields: ['name', 'thumb', 'url', 'type'],
83 url : '../../datasets/sencha-touch-examples.json',
92 this.callParent(arguments);
93 this.updateStoreSorters();
97 * Returns the array of Ext.util.Sorters defined by the current toolbar button order
98 * @return {Array} The sorters
100 getSorters: function() {
101 var buttons = this.query('toolbar sortbutton'),
103 Ext.Array.each(buttons, function(button) {
105 property : button.getDataIndex(),
106 direction: button.getDirection()
115 * Updates the DataView's Store's sorters based on the current Toolbar button configuration
117 updateStoreSorters: function() {
118 //FIXME: shouldn't have to make the first call
119 this.down('dataview').store.sort();
120 this.down('dataview').store.sort(this.getSorters());