3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
16 * @class Ext.grid.LockingView
17 * This class is used internally to provide a single interface when using
18 * a locking grid. Internally, the locking grid creates two separate grids,
19 * so this class is used to map calls appropriately.
22 Ext.define('Ext.grid.LockingView', {
25 observable: 'Ext.util.Observable'
28 eventRelayRe: /^(beforeitem|beforecontainer|item|container|cell)/,
30 constructor: function(config){
33 eventRe = me.eventRelayRe,
34 locked = config.locked.getView(),
35 normal = config.normal.getView(),
42 lockedGrid: config.locked,
43 normalGrid: config.normal,
46 me.mixins.observable.constructor.call(me, config);
49 events = locked.events;
50 for (event in events) {
51 if (events.hasOwnProperty(event) && eventRe.test(event)) {
52 eventNames.push(event);
55 me.relayEvents(locked, eventNames);
56 me.relayEvents(normal, eventNames);
60 itemmouseleave: me.onItemMouseLeave,
61 itemmouseenter: me.onItemMouseEnter
66 itemmouseleave: me.onItemMouseLeave,
67 itemmouseenter: me.onItemMouseEnter
71 getGridColumns: function() {
72 var cols = this.lockedGrid.headerCt.getGridColumns();
73 return cols.concat(this.normalGrid.headerCt.getGridColumns());
76 getEl: function(column){
77 return this.getViewForColumn(column).getEl();
80 getViewForColumn: function(column) {
81 var view = this.lockedView,
84 view.headerCt.cascade(function(col){
91 return inLocked ? view : this.normalView;
94 onItemMouseEnter: function(view, record){
96 locked = me.lockedView,
97 other = me.normalView,
100 if (view.trackOver) {
101 if (view !== locked) {
104 item = other.getNode(record);
105 other.highlightItem(item);
109 onItemMouseLeave: function(view, record){
111 locked = me.lockedView,
112 other = me.normalView;
114 if (view.trackOver) {
115 if (view !== locked) {
118 other.clearHighlight();
122 relayFn: function(name, args){
125 var view = this.lockedView;
126 view[name].apply(view, args || []);
127 view = this.normalView;
128 view[name].apply(view, args || []);
131 getSelectionModel: function(){
132 return this.panel.getSelectionModel();
135 getStore: function(){
136 return this.panel.store;
139 getNode: function(nodeInfo){
140 // default to the normal view
141 return this.normalView.getNode(nodeInfo);
144 getCell: function(record, column){
145 var view = this.getViewForColumn(column),
148 row = view.getNode(record);
149 return Ext.fly(row).down(column.getCellSelector());
152 getRecord: function(node){
153 var result = this.lockedView.getRecord(node);
155 result = this.normalView.getRecord(node);
160 addElListener: function(eventName, fn, scope){
161 this.relayFn('addElListener', arguments);
164 refreshNode: function(){
165 this.relayFn('refreshNode', arguments);
169 this.relayFn('refresh', arguments);
172 bindStore: function(){
173 this.relayFn('bindStore', arguments);
176 addRowCls: function(){
177 this.relayFn('addRowCls', arguments);
180 removeRowCls: function(){
181 this.relayFn('removeRowCls', arguments);