| 2150 |
mathias |
1 |
if(!dojo._hasResource["dojox.grid._grid.rows"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
|
|
2 |
dojo._hasResource["dojox.grid._grid.rows"] = true;
|
|
|
3 |
dojo.provide("dojox.grid._grid.rows");
|
|
|
4 |
|
|
|
5 |
dojo.declare("dojox.grid.rows", null, {
|
|
|
6 |
// Stores information about grid rows. Owned by grid and used internally.
|
|
|
7 |
constructor: function(inGrid){
|
|
|
8 |
this.grid = inGrid;
|
|
|
9 |
},
|
|
|
10 |
linesToEms: 2,
|
|
|
11 |
defaultRowHeight: 1, // lines
|
|
|
12 |
overRow: -2,
|
|
|
13 |
// metrics
|
|
|
14 |
getHeight: function(inRowIndex){
|
|
|
15 |
return '';
|
|
|
16 |
},
|
|
|
17 |
getDefaultHeightPx: function(){
|
|
|
18 |
// summmary:
|
|
|
19 |
// retrieves the default row height
|
|
|
20 |
// returns: int, default row height
|
|
|
21 |
return 32;
|
|
|
22 |
//return Math.round(this.defaultRowHeight * this.linesToEms * this.grid.contentPixelToEmRatio);
|
|
|
23 |
},
|
|
|
24 |
// styles
|
|
|
25 |
prepareStylingRow: function(inRowIndex, inRowNode){
|
|
|
26 |
return {
|
|
|
27 |
index: inRowIndex,
|
|
|
28 |
node: inRowNode,
|
|
|
29 |
odd: Boolean(inRowIndex&1),
|
|
|
30 |
selected: this.grid.selection.isSelected(inRowIndex),
|
|
|
31 |
over: this.isOver(inRowIndex),
|
|
|
32 |
customStyles: "",
|
|
|
33 |
customClasses: "dojoxGrid-row"
|
|
|
34 |
}
|
|
|
35 |
},
|
|
|
36 |
styleRowNode: function(inRowIndex, inRowNode){
|
|
|
37 |
var row = this.prepareStylingRow(inRowIndex, inRowNode);
|
|
|
38 |
this.grid.onStyleRow(row);
|
|
|
39 |
this.applyStyles(row);
|
|
|
40 |
},
|
|
|
41 |
applyStyles: function(inRow){
|
|
|
42 |
with(inRow){
|
|
|
43 |
node.className = customClasses;
|
|
|
44 |
var h = node.style.height;
|
|
|
45 |
dojox.grid.setStyleText(node, customStyles + ';' + (node._style||''));
|
|
|
46 |
node.style.height = h;
|
|
|
47 |
}
|
|
|
48 |
},
|
|
|
49 |
updateStyles: function(inRowIndex){
|
|
|
50 |
this.grid.updateRowStyles(inRowIndex);
|
|
|
51 |
},
|
|
|
52 |
// states and events
|
|
|
53 |
setOverRow: function(inRowIndex){
|
|
|
54 |
var last = this.overRow;
|
|
|
55 |
this.overRow = inRowIndex;
|
|
|
56 |
if((last!=this.overRow)&&(last >=0)){
|
|
|
57 |
this.updateStyles(last);
|
|
|
58 |
}
|
|
|
59 |
this.updateStyles(this.overRow);
|
|
|
60 |
},
|
|
|
61 |
isOver: function(inRowIndex){
|
|
|
62 |
return (this.overRow == inRowIndex);
|
|
|
63 |
}
|
|
|
64 |
});
|
|
|
65 |
|
|
|
66 |
}
|