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/grid/CheckboxSelectionModel.js @ 76

Revision 76, 4.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.grid.CheckboxSelectionModel
9 * @extends Ext.grid.RowSelectionModel
10 * A custom selection model that renders a column of checkboxes that can be toggled to select or deselect rows.
11 * @constructor
12 * @param {Object} config The configuration options
13 */
14Ext.grid.CheckboxSelectionModel = Ext.extend(Ext.grid.RowSelectionModel, {
15
16    /**
17     * @cfg {Boolean} checkOnly <tt>true</tt> if rows can only be selected by clicking on the
18     * checkbox column (defaults to <tt>false</tt>).
19     */
20    /**
21     * @cfg {String} header Any valid text or HTML fragment to display in the header cell for the
22     * checkbox column.  Defaults to:<pre><code>
23     * '&lt;div class="x-grid3-hd-checker">&#38;#160;&lt;/div>'</tt>
24     * </code></pre>
25     * The default CSS class of <tt>'x-grid3-hd-checker'</tt> displays a checkbox in the header
26     * and provides support for automatic check all/none behavior on header click. This string
27     * can be replaced by any valid HTML fragment, including a simple text string (e.g.,
28     * <tt>'Select Rows'</tt>), but the automatic check all/none behavior will only work if the
29     * <tt>'x-grid3-hd-checker'</tt> class is supplied.
30     */
31    header : '<div class="x-grid3-hd-checker">&#160;</div>',
32    /**
33     * @cfg {Number} width The default width in pixels of the checkbox column (defaults to <tt>20</tt>).
34     */
35    width : 20,
36    /**
37     * @cfg {Boolean} sortable <tt>true</tt> if the checkbox column is sortable (defaults to
38     * <tt>false</tt>).
39     */
40    sortable : false,
41
42    // private
43    menuDisabled : true,
44    fixed : true,
45    hideable: false,
46    dataIndex : '',
47    id : 'checker',
48    isColumn: true, // So that ColumnModel doesn't feed this through the Column constructor
49
50    constructor : function(){
51        Ext.grid.CheckboxSelectionModel.superclass.constructor.apply(this, arguments);
52        if(this.checkOnly){
53            this.handleMouseDown = Ext.emptyFn;
54        }
55    },
56
57    // private
58    initEvents : function(){
59        Ext.grid.CheckboxSelectionModel.superclass.initEvents.call(this);
60        this.grid.on('render', function(){
61            Ext.fly(this.grid.getView().innerHd).on('mousedown', this.onHdMouseDown, this);
62        }, this);
63    },
64
65    /**
66     * @private
67     * Process and refire events routed from the GridView's processEvent method.
68     */
69    processEvent : function(name, e, grid, rowIndex, colIndex){
70        if (name == 'mousedown') {
71            this.onMouseDown(e, e.getTarget());
72            return false;
73        } else {
74            return Ext.grid.Column.prototype.processEvent.apply(this, arguments);
75        }
76    },
77
78    // private
79    onMouseDown : function(e, t){
80        if(e.button === 0 && t.className == 'x-grid3-row-checker'){ // Only fire if left-click
81            e.stopEvent();
82            var row = e.getTarget('.x-grid3-row');
83            if(row){
84                var index = row.rowIndex;
85                if(this.isSelected(index)){
86                    this.deselectRow(index);
87                }else{
88                    this.selectRow(index, true);
89                    this.grid.getView().focusRow(index);
90                }
91            }
92        }
93    },
94
95    // private
96    onHdMouseDown : function(e, t) {
97        if(t.className == 'x-grid3-hd-checker'){
98            e.stopEvent();
99            var hd = Ext.fly(t.parentNode);
100            var isChecked = hd.hasClass('x-grid3-hd-checker-on');
101            if(isChecked){
102                hd.removeClass('x-grid3-hd-checker-on');
103                this.clearSelections();
104            }else{
105                hd.addClass('x-grid3-hd-checker-on');
106                this.selectAll();
107            }
108        }
109    },
110
111    // private
112    renderer : function(v, p, record){
113        return '<div class="x-grid3-row-checker">&#160;</div>';
114    },
115   
116    onEditorSelect: function(row, lastRow){
117        if(lastRow != row && !this.checkOnly){
118            this.selectRow(row); // *** highlight newly-selected cell and update selection
119        }
120    }
121});
Note: See TracBrowser for help on using the repository browser.