1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
/*
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
if(!dojo._hasResource["dojox.grid.util"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo._hasResource["dojox.grid.util"] = true;
dojo.provide("dojox.grid.util");
// summary: grid utility library
(function(){
var dgu = dojox.grid.util;
dgu.na = '...';
dgu.rowIndexTag = "gridRowIndex";
dgu.gridViewTag = "gridView";
dgu.fire = function(ob, ev, args){
var fn = ob && ev && ob[ev];
return fn && (args ? fn.apply(ob, args) : ob[ev]());
};
dgu.setStyleHeightPx = function(inElement, inHeight){
if(inHeight >= 0){
var s = inElement.style;
var v = inHeight + 'px';
if(inElement && s['height'] != v){
s['height'] = v;
}
}
};
dgu.mouseEvents = [ 'mouseover', 'mouseout', /*'mousemove',*/ 'mousedown', 'mouseup', 'click', 'dblclick', 'contextmenu' ];
dgu.keyEvents = [ 'keyup', 'keydown', 'keypress' ];
dgu.funnelEvents = function(inNode, inObject, inMethod, inEvents){
var evts = (inEvents ? inEvents : dgu.mouseEvents.concat(dgu.keyEvents));
for (var i=0, l=evts.length; i<l; i++){
inObject.connect(inNode, 'on' + evts[i], inMethod);
}
};
dgu.removeNode = function(inNode){
inNode = dojo.byId(inNode);
inNode && inNode.parentNode && inNode.parentNode.removeChild(inNode);
return inNode;
};
dgu.arrayCompare = function(inA, inB){
for(var i=0,l=inA.length; i<l; i++){
if(inA[i] != inB[i]){return false;}
}
return (inA.length == inB.length);
};
dgu.arrayInsert = function(inArray, inIndex, inValue){
if(inArray.length <= inIndex){
inArray[inIndex] = inValue;
}else{
inArray.splice(inIndex, 0, inValue);
}
};
dgu.arrayRemove = function(inArray, inIndex){
inArray.splice(inIndex, 1);
};
dgu.arraySwap = function(inArray, inI, inJ){
var cache = inArray[inI];
inArray[inI] = inArray[inJ];
inArray[inJ] = cache;
};
})();
}
|