-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy pathSlantedHeader.js
54 lines (46 loc) · 1.36 KB
/
SlantedHeader.js
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
define([
"dojo/_base/declare",
"dojo/_base/array",
"dojo/_base/lang",
"dojo/_base/event",
"dojo/query",
"dojo/string",
"dojo/dom-class",
"dojo/dom-construct",
"dojo/keys",
"../core/_Module",
"./GroupHeader"
], function(declare, array, lang, event, query, string, domClass, domConstruct, keys, _Module, Sort, nls){
/*=====
return declare(_Module, {
// summary:
// module name: slantedheader.
// Slant headers including group headers.
});
=====*/
return declare(_Module, {
name: 'slantedheader',
_actionAreaHolder: null,
required: ['header'],
load: function(args, deferStartup){
domClass.add(this.grid.domNode, 'gridxSlantedHeader');
var self = this;
window.setTimeout(function(){
//Need a timeout so that the header height is available.
//Skew the header node, and use translate to align columns
self._updateTransform();
},0);
this.connect(this.grid, 'resize', '_updateTransform');
this.loaded.callback();
},
_updateTransform: function(){
var n = this.grid.header.domNode;
var headerHeight = n.offsetHeight;
console.log('header height: ', headerHeight);
var translateX = Math.round(headerHeight/2) - 1; //TODO: 1 is the top border width
n.style.transform = n.style.msTransform = n.style.mozTransform
= n.style.webkitTransform = 'translate(' + translateX
+ 'px, 0px) skew(-45deg,0deg)';
}
});
});