2 * @class Ext.multisort.Panel
3 * @extends Ext.panel.Panel
8 Ext.define('Ext.multisort.Panel', {
9 extend: 'Ext.panel.Panel',
13 title: 'Multisort DataView',
16 requires: ['Ext.toolbar.TextItem', 'Ext.view.View'],
18 initComponent: function() {
19 this.tbar = Ext.create('Ext.toolbar.Toolbar', {
20 plugins : Ext.create('Ext.ux.BoxReorderer', {
24 this.down('dataview').store.sort(this.getSorters());
31 changeDirection: this.updateStoreSorters
36 text: 'Sort on these fields:',
54 (!Ext.isIE6? '<img src="../../datasets/touch-icons/{thumb}" />' :
55 '<div style="position:relative;width:74px;height:74px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'../../datasets/touch-icons/{thumb}\')"></div>'),
60 plugins: [Ext.create('Ext.ux.DataView.Animated')],
61 itemSelector: 'div.item',
62 store: Ext.create('Ext.data.Store', {
66 fields: ['name', 'thumb', 'url', 'type'],
69 url : '../../datasets/sencha-touch-examples.json',
78 this.callParent(arguments);
79 this.updateStoreSorters();
83 * Returns the array of Ext.util.Sorters defined by the current toolbar button order
84 * @return {Array} The sorters
86 getSorters: function() {
87 var buttons = this.query('toolbar sortbutton'),
89 Ext.Array.each(buttons, function(button) {
91 property : button.getDataIndex(),
92 direction: button.getDirection()
101 * Updates the DataView's Store's sorters based on the current Toolbar button configuration
103 updateStoreSorters: function() {
104 //FIXME: shouldn't have to make the first call
105 this.down('dataview').store.sort();
106 this.down('dataview').store.sort(this.getSorters());