1 | define([ |
---|
2 | "dojo/_base/declare", |
---|
3 | "./_View" |
---|
4 | ], function(declare, _View){ |
---|
5 | |
---|
6 | return declare('dojox.grid._RowSelector', _View, { |
---|
7 | // summary: |
---|
8 | // Custom grid view. If used in a grid structure, provides a small selectable region for grid rows. |
---|
9 | defaultWidth: "2em", |
---|
10 | noscroll: true, |
---|
11 | padBorderWidth: 2, |
---|
12 | buildRendering: function(){ |
---|
13 | this.inherited('buildRendering', arguments); |
---|
14 | this.scrollboxNode.style.overflow = "hidden"; |
---|
15 | this.headerNode.style.visibility = "hidden"; |
---|
16 | }, |
---|
17 | getWidth: function(){ |
---|
18 | return this.viewWidth || this.defaultWidth; |
---|
19 | }, |
---|
20 | buildRowContent: function(inRowIndex, inRowNode){ |
---|
21 | var w = this.contentWidth || 0; |
---|
22 | inRowNode.innerHTML = '<table class="dojoxGridRowbarTable" style="width:' + w + 'px;height:1px;" border="0" cellspacing="0" cellpadding="0" role="presentation"><tr><td class="dojoxGridRowbarInner"> </td></tr></table>'; |
---|
23 | }, |
---|
24 | renderHeader: function(){ |
---|
25 | }, |
---|
26 | updateRow: function(){ |
---|
27 | }, |
---|
28 | resize: function(){ |
---|
29 | this.adaptHeight(); |
---|
30 | }, |
---|
31 | adaptWidth: function(){ |
---|
32 | // Only calculate this here - rather than every call to buildRowContent |
---|
33 | if(!("contentWidth" in this) && this.contentNode && this.contentNode.offsetWidth > 0){ |
---|
34 | this.contentWidth = this.contentNode.offsetWidth - this.padBorderWidth; |
---|
35 | } |
---|
36 | }, |
---|
37 | // styling |
---|
38 | doStyleRowNode: function(inRowIndex, inRowNode){ |
---|
39 | var n = [ "dojoxGridRowbar dojoxGridNonNormalizedCell" ]; |
---|
40 | if(this.grid.rows.isOver(inRowIndex)){ |
---|
41 | n.push("dojoxGridRowbarOver"); |
---|
42 | } |
---|
43 | if(this.grid.selection.isSelected(inRowIndex)){ |
---|
44 | n.push("dojoxGridRowbarSelected"); |
---|
45 | } |
---|
46 | inRowNode.className = n.join(" "); |
---|
47 | }, |
---|
48 | // event handlers |
---|
49 | domouseover: function(e){ |
---|
50 | this.grid.onMouseOverRow(e); |
---|
51 | }, |
---|
52 | domouseout: function(e){ |
---|
53 | if(!this.isIntraRowEvent(e)){ |
---|
54 | this.grid.onMouseOutRow(e); |
---|
55 | } |
---|
56 | } |
---|
57 | }); |
---|
58 | }); |
---|