source: trunk/web/addons/job_monarch/lib/extjs-30/src/widgets/grid/RowNumberer.js @ 625

Last change on this file since 625 was 625, checked in by ramonb, 15 years ago

lib/extjs-30:

  • new ExtJS 3.0
File size: 1.7 KB
Line 
1/*!
2 * Ext JS Library 3.0.0
3 * Copyright(c) 2006-2009 Ext JS, LLC
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 */
24Ext.grid.RowNumberer = function(config){
25    Ext.apply(this, config);
26    if(this.rowspan){
27        this.renderer = this.renderer.createDelegate(this);
28    }
29};
30
31Ext.grid.RowNumberer.prototype = {
32    /**
33     * @cfg {String} header Any valid text or HTML fragment to display in the header cell for the row
34     * number column (defaults to '').
35     */
36    header: "",
37    /**
38     * @cfg {Number} width The default width in pixels of the row number column (defaults to 23).
39     */
40    width: 23,
41    /**
42     * @cfg {Boolean} sortable True if the row number column is sortable (defaults to false).
43     * @hide
44     */
45    sortable: false,
46
47    // private
48    fixed:true,
49    menuDisabled:true,
50    dataIndex: '',
51    id: 'numberer',
52    rowspan: undefined,
53
54    // private
55    renderer : function(v, p, record, rowIndex){
56        if(this.rowspan){
57            p.cellAttr = 'rowspan="'+this.rowspan+'"';
58        }
59        return rowIndex+1;
60    }
61};
Note: See TracBrowser for help on using the repository browser.