Bienvenue sur PostGIS.fr

Bienvenue sur PostGIS.fr , le site de la communauté des utilisateurs francophones de PostGIS.

PostGIS ajoute le support d'objets géographique à la base de données PostgreSQL. En effet, PostGIS "spatialise" le serverur PostgreSQL, ce qui permet de l'utiliser comme une base de données SIG.

Maintenu à jour, en fonction de nos disponibilités et des diverses sorties des outils que nous testons, nous vous proposons l'ensemble de nos travaux publiés en langue française.

source: trunk/workshop-routing-foss4g/web/ext/src/widgets/list/Sorter.js @ 76

Revision 76, 2.1 KB checked in by djay, 12 years ago (diff)

Ajout du répertoire web

  • Property svn:executable set to *
Line 
1/*!
2 * Ext JS Library 3.4.0
3 * Copyright(c) 2006-2011 Sencha Inc.
4 * licensing@sencha.com
5 * http://www.sencha.com/license
6 */
7/**
8 * @class Ext.list.Sorter
9 * @extends Ext.util.Observable
10 * <p>Supporting Class for Ext.list.ListView</p>
11 * @constructor
12 * @param {Object} config
13 */
14Ext.list.Sorter = Ext.extend(Ext.util.Observable, {
15    /**
16     * @cfg {Array} sortClasses
17     * The CSS classes applied to a header when it is sorted. (defaults to <tt>["sort-asc", "sort-desc"]</tt>)
18     */
19    sortClasses : ["sort-asc", "sort-desc"],
20
21    constructor: function(config){
22        Ext.apply(this, config);
23        Ext.list.Sorter.superclass.constructor.call(this);
24    },
25
26    init : function(listView){
27        this.view = listView;
28        listView.on('render', this.initEvents, this);
29    },
30
31    initEvents : function(view){
32        view.mon(view.innerHd, 'click', this.onHdClick, this);
33        view.innerHd.setStyle('cursor', 'pointer');
34        view.mon(view.store, 'datachanged', this.updateSortState, this);
35        this.updateSortState.defer(10, this, [view.store]);
36    },
37
38    updateSortState : function(store){
39        var state = store.getSortState();
40        if(!state){
41            return;
42        }
43        this.sortState = state;
44        var cs = this.view.columns, sortColumn = -1;
45        for(var i = 0, len = cs.length; i < len; i++){
46            if(cs[i].dataIndex == state.field){
47                sortColumn = i;
48                break;
49            }
50        }
51        if(sortColumn != -1){
52            var sortDir = state.direction;
53            this.updateSortIcon(sortColumn, sortDir);
54        }
55    },
56
57    updateSortIcon : function(col, dir){
58        var sc = this.sortClasses;
59        var hds = this.view.innerHd.select('em').removeClass(sc);
60        hds.item(col).addClass(sc[dir == "DESC" ? 1 : 0]);
61    },
62
63    onHdClick : function(e){
64        var hd = e.getTarget('em', 3);
65        if(hd && !this.view.disableHeaders){
66            var index = this.view.findHeaderIndex(hd);
67            this.view.store.sort(this.view.columns[index].dataIndex);
68        }
69    }
70});
71
72// Backwards compatibility alias
73Ext.ListView.Sorter = Ext.list.Sorter;
Note: See TracBrowser for help on using the repository browser.