| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 | 
							- <!DOCTYPE html>
 
- <html>
 
- <head>
 
-   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
-   <title>The source code</title>
 
-   <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
 
-   <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
 
-   <style type="text/css">
 
-     .highlight { display: block; background-color: #ddd; }
 
-   </style>
 
-   <script type="text/javascript">
 
-     function highlight() {
 
-       document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
 
-     }
 
-   </script>
 
- </head>
 
- <body onload="prettyPrint(); highlight();">
 
-   <pre class="prettyprint lang-js"><span id='Ext-ux-CheckColumn'>/**
 
- </span> * @class Ext.ux.CheckColumn
 
-  * @extends Ext.grid.column.Column
 
-  * A Header subclass which renders a checkbox in each column cell which toggles the truthiness of the associated data field on click.
 
-  *
 
-  * Example usage:
 
-  * 
 
-  *    // create the grid
 
-  *    var grid = Ext.create('Ext.grid.Panel', {
 
-  *        ...
 
-  *        columns: [{
 
-  *           text: 'Foo',
 
-  *           ...
 
-  *        },{
 
-  *           xtype: 'checkcolumn',
 
-  *           text: 'Indoor?',
 
-  *           dataIndex: 'indoor',
 
-  *           width: 55
 
-  *        }]
 
-  *        ...
 
-  *    });
 
-  *
 
-  * In addition to toggling a Boolean value within the record data, this
 
-  * class adds or removes a css class <tt>'x-grid-checked'</tt> on the td
 
-  * based on whether or not it is checked to alter the background image used
 
-  * for a column.
 
-  */
 
- Ext.define('Ext.ux.CheckColumn', {
 
-     extend: 'Ext.grid.column.Column',
 
-     alias: 'widget.checkcolumn',
 
- <span id='Ext-ux-CheckColumn-cfg-stopSelection'>    /**
 
- </span>     * @cfg {Boolean} [stopSelection=true]
 
-      * Prevent grid selection upon mousedown.
 
-      */
 
-     stopSelection: true,
 
-     tdCls: Ext.baseCSSPrefix + 'grid-cell-checkcolumn',
 
-     constructor: function() {
 
-         this.addEvents(
 
- <span id='Ext-ux-CheckColumn-event-beforecheckchange'>            /**
 
- </span>             * @event beforecheckchange
 
-              * Fires when before checked state of a row changes.
 
-              * The change may be vetoed by returning `false` from a listener.
 
-              * @param {Ext.ux.CheckColumn} this CheckColumn
 
-              * @param {Number} rowIndex The row index
 
-              * @param {Boolean} checked True if the box is to be checked
 
-              */
 
-             'beforecheckchange',
 
- <span id='Ext-ux-CheckColumn-event-checkchange'>            /**
 
- </span>             * @event checkchange
 
-              * Fires when the checked state of a row changes
 
-              * @param {Ext.ux.CheckColumn} this CheckColumn
 
-              * @param {Number} rowIndex The row index
 
-              * @param {Boolean} checked True if the box is now checked
 
-              */
 
-             'checkchange'
 
-         );
 
-         this.callParent(arguments);
 
-     },
 
- <span id='Ext-ux-CheckColumn-method-processEvent'>    /**
 
- </span>     * @private
 
-      * Process and refire events routed from the GridView's processEvent method.
 
-      */
 
-     processEvent: function(type, view, cell, recordIndex, cellIndex, e, record, row) {
 
-         var me = this,
 
-             key = type === 'keydown' && e.getKey(),
 
-             mousedown = type == 'mousedown';
 
-         if (mousedown || (key == e.ENTER || key == e.SPACE)) {
 
-             var dataIndex = me.dataIndex,
 
-                 checked = !record.get(dataIndex);
 
-             // Allow apps to hook beforecheckchange
 
-             if (me.fireEvent('beforecheckchange', me, recordIndex, checked) !== false) {
 
-                 record.set(dataIndex, checked);
 
-                 me.fireEvent('checkchange', me, recordIndex, checked);
 
-                 // Mousedown on the now nonexistent cell causes the view to blur, so stop it continuing.
 
-                 if (mousedown) {
 
-                     e.stopEvent();
 
-                 }
 
-                 // Selection will not proceed after this because of the DOM update caused by the record modification
 
-                 // Invoke the SelectionModel unless configured not to do so
 
-                 if (!me.stopSelection) {
 
-                     view.selModel.selectByPosition({
 
-                         row: recordIndex,
 
-                         column: cellIndex
 
-                     });
 
-                 }
 
-                 // Prevent the view from propagating the event to the selection model - we have done that job.
 
-                 return false;
 
-             } else {
 
-                 // Prevent the view from propagating the event to the selection model if configured to do so.
 
-                 return !me.stopSelection;
 
-             }
 
-         } else {
 
-             return me.callParent(arguments);
 
-         }
 
-     },
 
-     // Note: class names are not placed on the prototype bc renderer scope
 
-     // is not in the header.
 
-     renderer : function(value){
 
-         var cssPrefix = Ext.baseCSSPrefix,
 
-             cls = [cssPrefix + 'grid-checkheader'];
 
-         if (value) {
 
-             cls.push(cssPrefix + 'grid-checkheader-checked');
 
-         }
 
-         return '<div class="' + cls.join(' ') + '">&#160;</div>';
 
-     }
 
- });
 
- </pre>
 
- </body>
 
- </html>
 
 
  |