~dongpo-deng/sahana-eden/test

« back to all changes in this revision

Viewing changes to static/scripts/ext/src/widgets/grid/RowNumberer.js

  • Committer: Deng Dongpo
  • Date: 2010-08-01 09:29:44 UTC
  • Revision ID: dongpo@dhcp-21193.iis.sinica.edu.tw-20100801092944-8t9obt4xtl7otesb
initial

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*!
 
2
 * Ext JS Library 3.2.1
 
3
 * Copyright(c) 2006-2010 Ext JS, Inc.
 
4
 * licensing@extjs.com
 
5
 * http://www.extjs.com/license
 
6
 */
 
7
/**
 
8
 * @class Ext.grid.RowNumberer
 
9
 * This is a utility class that can be passed into a {@link Ext.grid.ColumnModel} as a column config that provides
 
10
 * an automatic row numbering column.
 
11
 * <br>Usage:<br>
 
12
 <pre><code>
 
13
 // This is a typical column config with the first column providing row numbers
 
14
 var colModel = new Ext.grid.ColumnModel([
 
15
    new Ext.grid.RowNumberer(),
 
16
    {header: "Name", width: 80, sortable: true},
 
17
    {header: "Code", width: 50, sortable: true},
 
18
    {header: "Description", width: 200, sortable: true}
 
19
 ]);
 
20
 </code></pre>
 
21
 * @constructor
 
22
 * @param {Object} config The configuration options
 
23
 */
 
24
Ext.grid.RowNumberer = Ext.extend(Object, {
 
25
    /**
 
26
     * @cfg {String} header Any valid text or HTML fragment to display in the header cell for the row
 
27
     * number column (defaults to '').
 
28
     */
 
29
    header: "",
 
30
    /**
 
31
     * @cfg {Number} width The default width in pixels of the row number column (defaults to 23).
 
32
     */
 
33
    width: 23,
 
34
    /**
 
35
     * @cfg {Boolean} sortable True if the row number column is sortable (defaults to false).
 
36
     * @hide
 
37
     */
 
38
    sortable: false,
 
39
    
 
40
    constructor : function(config){
 
41
        Ext.apply(this, config);
 
42
        if(this.rowspan){
 
43
            this.renderer = this.renderer.createDelegate(this);
 
44
        }
 
45
    },
 
46
 
 
47
    // private
 
48
    fixed:true,
 
49
    hideable: false,
 
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'