12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- /*
- * Ext JS Library 2.0 Copyright(c) 2006-2007, Ext JS, LLC. licensing@extjs.com
- *
- * http://extjs.com/license
- */
- Ext.grid.CheckboxSelectionModel = Ext.extend(Ext.grid.RowSelectionModel, {
- header : "<div class=\"x-grid3-hd-checker\"> </div>",
- width : 20,
- sortable : false,
- fixed : true,
- dataIndex : "",
- id : "checker",
- initEvents : function() {
- Ext.grid.CheckboxSelectionModel.superclass.initEvents
- .call(this);
- this.grid.on("render", function() {
- var A = this.grid.getView();
- A.mainBody.on("mousedown", this.onMouseDown, this);
- Ext.fly(A.innerHd).on("mousedown",
- this.onHdMouseDown, this)
- }, this)
- },
- onMouseDown : function(C, B) {
- if (B.className == "x-grid3-row-checker") {
- C.stopEvent();
- var D = C.getTarget(".x-grid3-row");
- if (D) {
- var A = D.rowIndex;
- if (this.isSelected(A)) {
- this.deselectRow(A)
- } else {
- this.selectRow(A, true)
- }
- }
- }
- },
- onHdMouseDown : function(C, A) {
- if (A.className == "x-grid3-hd-checker") {
- C.stopEvent();
- var B = Ext.fly(A.parentNode);
- var D = B.hasClass("x-grid3-hd-checker-on");
- if (D) {
- B.removeClass("x-grid3-hd-checker-on");
- this.clearSelections()
- } else {
- B.addClass("x-grid3-hd-checker-on");
- this.selectAll()
- }
- }
- },
- renderer : function(B, C, A) {
- return "<div class=\"x-grid3-row-checker\"> </div>"
- }
- });
|