Web UI for ARGUS server
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.

80 lines
2.5 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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.3.1
  11. * Copyright(c) 2006-2010 Sencha Inc.
  12. * licensing@sencha.com
  13. * http://www.sencha.com/license
  14. */
  15. Ext.ns('Ext.ux.grid');
  16. /**
  17. * @class Ext.ux.grid.CheckColumn
  18. * @extends Ext.grid.Column
  19. * <p>A Column subclass which renders a checkbox in each column cell which toggles the truthiness of the associated data field on click.</p>
  20. * <p><b>Note. As of ExtJS 3.3 this no longer has to be configured as a plugin of the GridPanel.</b></p>
  21. * <p>Example usage:</p>
  22. * <pre><code>
  23. var cm = new Ext.grid.ColumnModel([{
  24. header: 'Foo',
  25. ...
  26. },{
  27. xtype: 'checkcolumn',
  28. header: 'Indoor?',
  29. dataIndex: 'indoor',
  30. width: 55
  31. }
  32. ]);
  33. // create the grid
  34. var grid = new Ext.grid.EditorGridPanel({
  35. ...
  36. colModel: cm,
  37. ...
  38. });
  39. * </code></pre>
  40. * In addition to toggling a Boolean value within the record data, this
  41. * class toggles a css class between <tt>'x-grid3-check-col'</tt> and
  42. * <tt>'x-grid3-check-col-on'</tt> to alter the background image used for
  43. * a column.
  44. */
  45. Ext.ux.grid.CheckColumn = Ext.extend(Ext.grid.Column, {
  46. /**
  47. * @private
  48. * Process and refire events routed from the GridView's processEvent method.
  49. */
  50. processEvent : function(name, e, grid, rowIndex, colIndex){
  51. if (name == 'mousedown') {
  52. var record = grid.store.getAt(rowIndex);
  53. record.set(this.dataIndex, !record.data[this.dataIndex]);
  54. return false; // Cancel row selection.
  55. } else {
  56. return Ext.grid.ActionColumn.superclass.processEvent.apply(this, arguments);
  57. }
  58. },
  59. renderer : function(v, p, record){
  60. p.css += ' x-grid3-check-col-td';
  61. return String.format('<div class="x-grid3-check-col{0}">&#160;</div>', v ? '-on' : '');
  62. },
  63. // Deprecate use as a plugin. Remove in 4.0
  64. init: Ext.emptyFn
  65. });
  66. // register ptype. Deprecate. Remove in 4.0
  67. Ext.preg('checkcolumn', Ext.ux.grid.CheckColumn);
  68. // backwards compat. Remove in 4.0
  69. Ext.grid.CheckColumn = Ext.ux.grid.CheckColumn;
  70. // register Column xtype
  71. Ext.grid.Column.types.checkcolumn = Ext.ux.grid.CheckColumn;</pre>
  72. </body>
  73. </html>