4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-grid-RowNumberer'>/**
19 </span> * @class Ext.grid.RowNumberer
20 * @extends Ext.grid.column.Column
21 * This is a utility class that can be passed into a {@link Ext.grid.column.Column} as a column config that provides
22 * an automatic row numbering column.
23 * <br>Usage:<br><pre><code>
25 Ext.create('Ext.grid.RowNumberer'),
26 {text: "Company", flex: 1, sortable: true, dataIndex: 'company'},
27 {text: "Price", width: 120, sortable: true, renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
28 {text: "Change", width: 120, sortable: true, dataIndex: 'change'},
29 {text: "% Change", width: 120, sortable: true, dataIndex: 'pctChange'},
30 {text: "Last Updated", width: 120, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
32 *</code></pre>
34 Ext.define('Ext.grid.RowNumberer', {
35 extend: 'Ext.grid.column.Column',
36 alias: 'widget.rownumberer',
37 <span id='Ext-grid-RowNumberer-cfg-text'> /**
38 </span> * @cfg {String} text Any valid text or HTML fragment to display in the header cell for the row
39 * number column (defaults to '&#160').
41 text: "&#160",
43 <span id='Ext-grid-RowNumberer-cfg-width'> /**
44 </span> * @cfg {Number} width The default width in pixels of the row number column (defaults to 23).
48 <span id='Ext-grid-RowNumberer-cfg-sortable'> /**
49 </span> * @cfg {Boolean} sortable True if the row number column is sortable (defaults to false).
56 constructor : function(config){
57 this.callParent(arguments);
59 this.renderer = Ext.Function.bind(this.renderer, this);
68 cls: Ext.baseCSSPrefix + 'row-numberer',
72 renderer: function(value, metaData, record, rowIdx, colIdx, store) {
74 metaData.cellAttr = 'rowspan="'+this.rowspan+'"';
77 metaData.tdCls = Ext.baseCSSPrefix + 'grid-cell-special';
78 return store.indexOfTotal(record) + 1;