Upgrade to ExtJS 3.2.1 - Released 04/27/2010
[extjs.git] / docs / source / RowNumberer.html
1 <html>
2 <head>
3   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    
4   <title>The source code</title>
5     <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6     <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
7 </head>
8 <body  onload="prettyPrint();">
9     <pre class="prettyprint lang-js">/*!
10  * Ext JS Library 3.2.1
11  * Copyright(c) 2006-2010 Ext JS, Inc.
12  * licensing@extjs.com
13  * http://www.extjs.com/license
14  */
15 <div id="cls-Ext.grid.RowNumberer"></div>/**
16  * @class Ext.grid.RowNumberer
17  * This is a utility class that can be passed into a {@link Ext.grid.ColumnModel} as a column config that provides
18  * an automatic row numbering column.
19  * <br>Usage:<br>
20  <pre><code>
21  // This is a typical column config with the first column providing row numbers
22  var colModel = new Ext.grid.ColumnModel([
23     new Ext.grid.RowNumberer(),
24     {header: "Name", width: 80, sortable: true},
25     {header: "Code", width: 50, sortable: true},
26     {header: "Description", width: 200, sortable: true}
27  ]);
28  </code></pre>
29  * @constructor
30  * @param {Object} config The configuration options
31  */
32 Ext.grid.RowNumberer = Ext.extend(Object, {
33     <div id="cfg-Ext.grid.RowNumberer-header"></div>/**
34      * @cfg {String} header Any valid text or HTML fragment to display in the header cell for the row
35      * number column (defaults to '').
36      */
37     header: "",
38     <div id="cfg-Ext.grid.RowNumberer-width"></div>/**
39      * @cfg {Number} width The default width in pixels of the row number column (defaults to 23).
40      */
41     width: 23,
42     <div id="cfg-Ext.grid.RowNumberer-sortable"></div>/**
43      * @cfg {Boolean} sortable True if the row number column is sortable (defaults to false).
44      * @hide
45      */
46     sortable: false,
47     
48     constructor : function(config){
49         Ext.apply(this, config);
50         if(this.rowspan){
51             this.renderer = this.renderer.createDelegate(this);
52         }
53     },
54
55     // private
56     fixed:true,
57     hideable: false,
58     menuDisabled:true,
59     dataIndex: '',
60     id: 'numberer',
61     rowspan: undefined,
62
63     // private
64     renderer : function(v, p, record, rowIndex){
65         if(this.rowspan){
66             p.cellAttr = 'rowspan="'+this.rowspan+'"';
67         }
68         return rowIndex+1;
69     }
70 });</pre>    
71 </body>
72 </html>