4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-grid-LockingView'>/**
19 </span> * @class Ext.grid.LockingView
20 * This class is used internally to provide a single interface when using
21 * a locking grid. Internally, the locking grid creates two separate grids,
22 * so this class is used to map calls appropriately.
25 Ext.define('Ext.grid.LockingView', {
28 observable: 'Ext.util.Observable'
31 eventRelayRe: /^(beforeitem|beforecontainer|item|container|cell)/,
33 constructor: function(config){
36 eventRe = me.eventRelayRe,
37 locked = config.locked.getView(),
38 normal = config.normal.getView(),
45 lockedGrid: config.locked,
46 normalGrid: config.normal,
49 me.mixins.observable.constructor.call(me, config);
52 events = locked.events;
53 for (event in events) {
54 if (events.hasOwnProperty(event) && eventRe.test(event)) {
55 eventNames.push(event);
58 me.relayEvents(locked, eventNames);
59 me.relayEvents(normal, eventNames);
63 itemmouseleave: me.onItemMouseLeave,
64 itemmouseenter: me.onItemMouseEnter
69 itemmouseleave: me.onItemMouseLeave,
70 itemmouseenter: me.onItemMouseEnter
74 getGridColumns: function() {
75 var cols = this.lockedGrid.headerCt.getGridColumns();
76 return cols.concat(this.normalGrid.headerCt.getGridColumns());
79 getEl: function(column){
80 return this.getViewForColumn(column).getEl();
83 getViewForColumn: function(column) {
84 var view = this.lockedView,
87 view.headerCt.cascade(function(col){
94 return inLocked ? view : this.normalView;
97 onItemMouseEnter: function(view, record){
99 locked = me.lockedView,
100 other = me.normalView,
103 if (view.trackOver) {
104 if (view !== locked) {
107 item = other.getNode(record);
108 other.highlightItem(item);
112 onItemMouseLeave: function(view, record){
114 locked = me.lockedView,
115 other = me.normalView;
117 if (view.trackOver) {
118 if (view !== locked) {
121 other.clearHighlight();
125 relayFn: function(name, args){
128 var view = this.lockedView;
129 view[name].apply(view, args || []);
130 view = this.normalView;
131 view[name].apply(view, args || []);
134 getSelectionModel: function(){
135 return this.panel.getSelectionModel();
138 getStore: function(){
139 return this.panel.store;
142 getNode: function(nodeInfo){
143 // default to the normal view
144 return this.normalView.getNode(nodeInfo);
147 getCell: function(record, column){
148 var view = this.getViewForColumn(column),
151 row = view.getNode(record);
152 return Ext.fly(row).down(column.getCellSelector());
155 getRecord: function(node){
156 var result = this.lockedView.getRecord(node);
158 result = this.normalView.getRecord(node);
163 addElListener: function(eventName, fn, scope){
164 this.relayFn('addElListener', arguments);
167 refreshNode: function(){
168 this.relayFn('refreshNode', arguments);
172 this.relayFn('refresh', arguments);
175 bindStore: function(){
176 this.relayFn('bindStore', arguments);
179 addRowCls: function(){
180 this.relayFn('addRowCls', arguments);
183 removeRowCls: function(){
184 this.relayFn('removeRowCls', arguments);