3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\r
4 <title>The source code</title>
\r
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
8 <body onload="prettyPrint();">
\r
9 <pre class="prettyprint lang-js"><div id="cls-Ext.grid.CheckboxSelectionModel"></div>/**
\r
10 * @class Ext.grid.CheckboxSelectionModel
\r
11 * @extends Ext.grid.RowSelectionModel
\r
12 * A custom selection model that renders a column of checkboxes that can be toggled to select or deselect rows.
\r
14 * @param {Object} config The configuration options
\r
16 Ext.grid.CheckboxSelectionModel = Ext.extend(Ext.grid.RowSelectionModel, {
\r
18 <div id="cfg-Ext.grid.CheckboxSelectionModel-checkOnly"></div>/**
\r
19 * @cfg {Boolean} checkOnly <tt>true</tt> if rows can only be selected by clicking on the
\r
20 * checkbox column (defaults to <tt>false</tt>).
\r
22 <div id="cfg-Ext.grid.CheckboxSelectionModel-header"></div>/**
\r
23 * @cfg {String} header Any valid text or HTML fragment to display in the header cell for the
\r
24 * checkbox column. Defaults to:<pre><code>
\r
25 * '<div class="x-grid3-hd-checker">&#160;</div>'</tt>
\r
27 * The default CSS class of <tt>'x-grid3-hd-checker'</tt> displays a checkbox in the header
\r
28 * and provides support for automatic check all/none behavior on header click. This string
\r
29 * can be replaced by any valid HTML fragment, including a simple text string (e.g.,
\r
30 * <tt>'Select Rows'</tt>), but the automatic check all/none behavior will only work if the
\r
31 * <tt>'x-grid3-hd-checker'</tt> class is supplied.
\r
33 header : '<div class="x-grid3-hd-checker"> </div>',
\r
34 <div id="cfg-Ext.grid.CheckboxSelectionModel-width"></div>/**
\r
35 * @cfg {Number} width The default width in pixels of the checkbox column (defaults to <tt>20</tt>).
\r
38 <div id="cfg-Ext.grid.CheckboxSelectionModel-sortable"></div>/**
\r
39 * @cfg {Boolean} sortable <tt>true</tt> if the checkbox column is sortable (defaults to
\r
45 menuDisabled : true,
\r
50 constructor : function(){
\r
51 Ext.grid.CheckboxSelectionModel.superclass.constructor.apply(this, arguments);
\r
54 this.handleMouseDown = Ext.emptyFn;
\r
59 initEvents : function(){
\r
60 Ext.grid.CheckboxSelectionModel.superclass.initEvents.call(this);
\r
61 this.grid.on('render', function(){
\r
62 var view = this.grid.getView();
\r
63 view.mainBody.on('mousedown', this.onMouseDown, this);
\r
64 Ext.fly(view.innerHd).on('mousedown', this.onHdMouseDown, this);
\r
70 onMouseDown : function(e, t){
\r
71 if(e.button === 0 && t.className == 'x-grid3-row-checker'){ // Only fire if left-click
\r
73 var row = e.getTarget('.x-grid3-row');
\r
75 var index = row.rowIndex;
\r
76 if(this.isSelected(index)){
\r
77 this.deselectRow(index);
\r
79 this.selectRow(index, true);
\r
86 onHdMouseDown : function(e, t){
\r
87 if(t.className == 'x-grid3-hd-checker'){
\r
89 var hd = Ext.fly(t.parentNode);
\r
90 var isChecked = hd.hasClass('x-grid3-hd-checker-on');
\r
92 hd.removeClass('x-grid3-hd-checker-on');
\r
93 this.clearSelections();
\r
95 hd.addClass('x-grid3-hd-checker-on');
\r
102 renderer : function(v, p, record){
\r
103 return '<div class="x-grid3-row-checker"> </div>';
\r