~mortenoh/+junk/dhis2-detailed-import-export

« back to all changes in this revision

Viewing changes to gis/dhis-gis-geostat/mfbase/ext/source/widgets/grid/RowNumberer.js

  • Committer: larshelge at gmail
  • Date: 2009-03-03 16:46:36 UTC
  • Revision ID: larshelge@gmail.com-20090303164636-2sjlrquo7ib1gf7r
Initial check-in

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Ext JS Library 2.2
 
3
 * Copyright(c) 2006-2008, Ext JS, LLC.
 
4
 * licensing@extjs.com
 
5
 * 
 
6
 * http://extjs.com/license
 
7
 */
 
8
 
 
9
/**
 
10
 * @class Ext.grid.RowNumberer
 
11
 * This is a utility class that can be passed into a {@link Ext.grid.ColumnModel} as a column config that provides
 
12
 * an automatic row numbering column.
 
13
 * <br>Usage:<br>
 
14
 <pre><code>
 
15
 // This is a typical column config with the first column providing row numbers
 
16
 var colModel = new Ext.grid.ColumnModel([
 
17
    new Ext.grid.RowNumberer(),
 
18
    {header: "Name", width: 80, sortable: true},
 
19
    {header: "Code", width: 50, sortable: true},
 
20
    {header: "Description", width: 200, sortable: true}
 
21
 ]);
 
22
 </code></pre>
 
23
 * @constructor
 
24
 * @param {Object} config The configuration options
 
25
*/
 
26
Ext.grid.RowNumberer = function(config){
 
27
    Ext.apply(this, config);
 
28
    if(this.rowspan){
 
29
        this.renderer = this.renderer.createDelegate(this);
 
30
    }
 
31
};
 
32
 
 
33
Ext.grid.RowNumberer.prototype = {
 
34
    /**
 
35
     * @cfg {String} header Any valid text or HTML fragment to display in the header cell for the row
 
36
     * number column (defaults to '').
 
37
     */
 
38
    header: "",
 
39
    /**
 
40
     * @cfg {Number} width The default width in pixels of the row number column (defaults to 23).
 
41
     */
 
42
    width: 23,
 
43
    /**
 
44
     * @cfg {Boolean} sortable True if the row number column is sortable (defaults to false).
 
45
     */
 
46
    sortable: false,
 
47
 
 
48
    // private
 
49
    fixed:true,
 
50
    menuDisabled:true,
 
51
    dataIndex: '',
 
52
    id: 'numberer',
 
53
    rowspan: undefined,
 
54
 
 
55
    // private
 
56
    renderer : function(v, p, record, rowIndex){
 
57
        if(this.rowspan){
 
58
            p.cellAttr = 'rowspan="'+this.rowspan+'"';
 
59
        }
 
60
        return rowIndex+1;
 
61
    }
 
62
};
 
 
b'\\ No newline at end of file'