source: trunk/web/addons/job_monarch/lib/extjs/source/widgets/grid/RowNumberer.js @ 619

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

lib/:

  • added new AJAX dependancies: ExtJS, pChart, Lightbox2
File size: 1.7 KB
Line 
1/*
2 * Ext JS Library 2.2.1
3 * Copyright(c) 2006-2009, 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*/
26Ext.grid.RowNumberer = function(config){
27    Ext.apply(this, config);
28    if(this.rowspan){
29        this.renderer = this.renderer.createDelegate(this);
30    }
31};
32
33Ext.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     * @hide
46     */
47    sortable: false,
48
49    // private
50    fixed:true,
51    menuDisabled:true,
52    dataIndex: '',
53    id: 'numberer',
54    rowspan: undefined,
55
56    // private
57    renderer : function(v, p, record, rowIndex){
58        if(this.rowspan){
59            p.cellAttr = 'rowspan="'+this.rowspan+'"';
60        }
61        return rowIndex+1;
62    }
63};
Note: See TracBrowser for help on using the repository browser.