You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
3.0 KiB

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