1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <title>API: datatable ColumnSet.js (YUI Library)
</title>
5 <link rel=
"stylesheet" type=
"text/css" href=
"assets/api.css">
9 <div id=
"doc3" class=
"yui-t2">
12 <h1>Yahoo! UI Library
</h1>
13 <h3>DataTable Widget
<span class=
"subtitle">2.2.0</span></h3>
15 <a href=
"./index.html">Yahoo! UI Library
</a>
16 > <a href=
"./module_datatable.html">datatable
</a>
18 > ColumnSet.js (source view)
27 <div class=
"highlight" ><pre><span class=
"c">/****************************************************************************/
</span>
28 <span class=
"c">/****************************************************************************/
</span>
29 <span class=
"c">/****************************************************************************/
</span>
31 <span class=
"c">/**
</span>
32 <span class=
"c"> * The ColumnSet class defines and manages a DataTable
's Columns,
</span>
33 <span class=
"c"> * including nested hierarchies and access to individual Column instances.
</span>
34 <span class=
"c"> *
</span>
35 <span class=
"c"> * @class ColumnSet
</span>
36 <span class=
"c"> * @uses YAHOO.util.EventProvider
</span>
37 <span class=
"c"> * @constructor
</span>
38 <span class=
"c"> * @param aHeaders {Object[]} Array of object literals that define header cells.
</span>
39 <span class=
"c"> */
</span>
40 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnSet
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">aHeaders
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
41 <span class=
"c">//TODO: break out nested functions into private methods
</span>
42 <span class=
"c"></span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">_sName
</span> <span class=
"o">=
</span> <span class=
"s2">"instance
"</span> <span class=
"o">+
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnSet
</span><span class=
"o">.
</span><span class=
"nx">_nCount
</span><span class=
"o">;
</span>
44 <span class=
"c">// Top-down tree representation of all Columns
</span>
45 <span class=
"c"></span> <span class=
"k">var
</span> <span class=
"nx">tree
</span> <span class=
"o">=
</span> <span class=
"o">[];
</span>
46 <span class=
"c">// Flat representation of all Columns
</span>
47 <span class=
"c"></span> <span class=
"k">var
</span> <span class=
"nx">flat
</span> <span class=
"o">=
</span> <span class=
"o">[];
</span>
48 <span class=
"c">// Flat representation of only Columns that display data
</span>
49 <span class=
"c"></span> <span class=
"k">var
</span> <span class=
"nx">keys
</span> <span class=
"o">=
</span> <span class=
"o">[];
</span>
50 <span class=
"c">// ID index of nested parent heirarchies for HEADERS attribute
</span>
51 <span class=
"c"></span> <span class=
"k">var
</span> <span class=
"nx">headers
</span> <span class=
"o">=
</span> <span class=
"o">[];
</span>
53 <span class=
"k">var
</span> <span class=
"nx">nodelevel
</span> <span class=
"o">=
</span> <span class=
"o">-
</span><span class=
"m">1</span><span class=
"o">;
</span>
55 <span class=
"c">// Internal recursive function to parse Columns out of object literal defs
</span>
56 <span class=
"c"></span> <span class=
"k">var
</span> <span class=
"nx">parseColumns
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">nodeList
</span><span class=
"o">,
</span> <span class=
"nx">parent
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
57 <span class=
"nx">nodelevel
</span><span class=
"o">++;
</span>
58 <span class=
"c">// A node level is an array of Columns
</span>
59 <span class=
"c"></span> <span class=
"k">if
</span><span class=
"o">(!
</span><span class=
"nx">tree
</span><span class=
"o">[
</span><span class=
"nx">nodelevel
</span><span class=
"o">])
</span> <span class=
"o">{
</span>
60 <span class=
"nx">tree
</span><span class=
"o">[
</span><span class=
"nx">nodelevel
</span><span class=
"o">]
</span> <span class=
"o">=
</span> <span class=
"o">[];
</span>
61 <span class=
"o">}
</span>
63 <span class=
"c">// Determine depth of descendants at this level for node
's rowspan
</span>
64 <span class=
"c"></span> <span class=
"k">var
</span> <span class=
"nx">nodeLevelMaxChildren
</span> <span class=
"o">=
</span> <span class=
"m">0</span><span class=
"o">;
</span>
65 <span class=
"k">var
</span> <span class=
"nx">recurseChildren
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">nodeList
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
66 <span class=
"k">var
</span> <span class=
"nx">tmpMax
</span> <span class=
"o">=
</span> <span class=
"m">0</span><span class=
"o">;
</span>
67 <span class=
"k">for
</span><span class=
"o">(
</span><span class=
"k">var
</span> <span class=
"nx">i
</span><span class=
"o">=
</span><span class=
"m">0</span><span class=
"o">;
</span> <span class=
"nx">i
</span><span class=
"o"><</span><span class=
"nx">nodeList
</span><span class=
"o">.
</span><span class=
"nx">length
</span><span class=
"o">;
</span> <span class=
"nx">i
</span><span class=
"o">++)
</span> <span class=
"o">{
</span>
68 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">nodeList
</span><span class=
"o">[
</span><span class=
"nx">i
</span><span class=
"o">].
</span><span class=
"nx">children
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
69 <span class=
"nx">tmpMax
</span><span class=
"o">++;
</span>
70 <span class=
"nx">recurseChildren
</span><span class=
"o">(
</span><span class=
"nx">nodeList
</span><span class=
"o">[
</span><span class=
"nx">i
</span><span class=
"o">].
</span><span class=
"nx">children
</span><span class=
"o">);
</span>
71 <span class=
"o">}
</span>
72 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">tmpMax
</span> <span class=
"o">></span> <span class=
"nx">nodeLevelMaxChildren
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
73 <span class=
"nx">nodeLevelMaxChildren
</span> <span class=
"o">=
</span> <span class=
"nx">tmpMax
</span><span class=
"o">;
</span>
74 <span class=
"o">}
</span>
75 <span class=
"o">}
</span>
76 <span class=
"o">};
</span>
77 <span class=
"nx">recurseChildren
</span><span class=
"o">(
</span><span class=
"nx">nodeList
</span><span class=
"o">);
</span>
79 <span class=
"c">// Parse each node for attributes and any children
</span>
80 <span class=
"c"></span> <span class=
"k">for
</span><span class=
"o">(
</span><span class=
"k">var
</span> <span class=
"nx">j
</span><span class=
"o">=
</span><span class=
"m">0</span><span class=
"o">;
</span> <span class=
"nx">j
</span><span class=
"o"><</span><span class=
"nx">nodeList
</span><span class=
"o">.
</span><span class=
"nx">length
</span><span class=
"o">;
</span> <span class=
"nx">j
</span><span class=
"o">++)
</span> <span class=
"o">{
</span>
81 <span class=
"c">// Instantiate a Column for each node
</span>
82 <span class=
"c"></span> <span class=
"k">var
</span> <span class=
"nx">oColumn
</span> <span class=
"o">=
</span> <span class=
"k">new
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">(
</span><span class=
"nx">nodeList
</span><span class=
"o">[
</span><span class=
"nx">j
</span><span class=
"o">]);
</span>
83 <span class=
"nx">flat
</span><span class=
"o">.
</span><span class=
"nx">push
</span><span class=
"o">(
</span><span class=
"nx">oColumn
</span><span class=
"o">);
</span>
85 <span class=
"c">// Assign parent, if applicable
</span>
86 <span class=
"c"></span> <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">parent
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
87 <span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">_parent
</span> <span class=
"o">=
</span> <span class=
"nx">parent
</span><span class=
"o">;
</span>
88 <span class=
"o">}
</span>
90 <span class=
"c">// Start with default values
</span>
91 <span class=
"c"></span> <span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">_rowspan
</span> <span class=
"o">=
</span> <span class=
"m">1</span><span class=
"o">;
</span>
92 <span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">_colspan
</span> <span class=
"o">=
</span> <span class=
"m">1</span><span class=
"o">;
</span>
94 <span class=
"c">// Column may have children
</span>
95 <span class=
"c"></span> <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">nodeList
</span><span class=
"o">[
</span><span class=
"nx">j
</span><span class=
"o">].
</span><span class=
"nx">children
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
96 <span class=
"k">var
</span> <span class=
"nx">children
</span> <span class=
"o">=
</span> <span class=
"nx">nodeList
</span><span class=
"o">[
</span><span class=
"nx">j
</span><span class=
"o">].
</span><span class=
"nx">children
</span><span class=
"o">;
</span>
97 <span class=
"k">var
</span> <span class=
"nx">length
</span> <span class=
"o">=
</span> <span class=
"nx">children
</span><span class=
"o">.
</span><span class=
"nx">length
</span><span class=
"o">;
</span>
99 <span class=
"c">// Cascade certain properties to children if not defined on their own
</span>
100 <span class=
"c"></span> <span class=
"k">for
</span><span class=
"o">(
</span><span class=
"k">var
</span> <span class=
"nx">k
</span><span class=
"o">=
</span><span class=
"m">0</span><span class=
"o">;
</span> <span class=
"nx">k
</span><span class=
"o"><</span><span class=
"nx">length
</span><span class=
"o">;
</span> <span class=
"nx">k
</span><span class=
"o">++)
</span> <span class=
"o">{
</span>
101 <span class=
"k">var
</span> <span class=
"nx">child
</span> <span class=
"o">=
</span> <span class=
"nx">children
</span><span class=
"o">[
</span><span class=
"nx">k
</span><span class=
"o">];
</span>
102 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">className
</span> <span class=
"o">&&</span> <span class=
"o">(
</span><span class=
"nx">child
</span><span class=
"o">.
</span><span class=
"nx">className
</span> <span class=
"o">===
</span> <span class=
"kc">undefined
</span><span class=
"o">))
</span> <span class=
"o">{
</span>
103 <span class=
"nx">child
</span><span class=
"o">.
</span><span class=
"nx">className
</span> <span class=
"o">=
</span> <span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">className
</span><span class=
"o">;
</span>
104 <span class=
"o">}
</span>
105 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">editor
</span> <span class=
"o">&&</span> <span class=
"o">(
</span><span class=
"nx">child
</span><span class=
"o">.
</span><span class=
"nx">editor
</span> <span class=
"o">===
</span> <span class=
"kc">undefined
</span><span class=
"o">))
</span> <span class=
"o">{
</span>
106 <span class=
"nx">child
</span><span class=
"o">.
</span><span class=
"nx">editor
</span> <span class=
"o">=
</span> <span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">editor
</span><span class=
"o">;
</span>
107 <span class=
"o">}
</span>
108 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">formatter
</span> <span class=
"o">&&</span> <span class=
"o">(
</span><span class=
"nx">child
</span><span class=
"o">.
</span><span class=
"nx">formatter
</span> <span class=
"o">===
</span> <span class=
"kc">undefined
</span><span class=
"o">))
</span> <span class=
"o">{
</span>
109 <span class=
"nx">child
</span><span class=
"o">.
</span><span class=
"nx">formatter
</span> <span class=
"o">=
</span> <span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">formatter
</span><span class=
"o">;
</span>
110 <span class=
"o">}
</span>
111 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">parser
</span> <span class=
"o">&&</span> <span class=
"o">(
</span><span class=
"nx">child
</span><span class=
"o">.
</span><span class=
"nx">parser
</span> <span class=
"o">===
</span> <span class=
"kc">undefined
</span><span class=
"o">))
</span> <span class=
"o">{
</span>
112 <span class=
"nx">child
</span><span class=
"o">.
</span><span class=
"nx">parser
</span> <span class=
"o">=
</span> <span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">parser
</span><span class=
"o">;
</span>
113 <span class=
"o">}
</span>
114 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">resizeable
</span> <span class=
"o">&&</span> <span class=
"o">(
</span><span class=
"nx">child
</span><span class=
"o">.
</span><span class=
"nx">resizeable
</span> <span class=
"o">===
</span> <span class=
"kc">undefined
</span><span class=
"o">))
</span> <span class=
"o">{
</span>
115 <span class=
"nx">child
</span><span class=
"o">.
</span><span class=
"nx">resizeable
</span> <span class=
"o">=
</span> <span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">resizeable
</span><span class=
"o">;
</span>
116 <span class=
"o">}
</span>
117 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">type
</span> <span class=
"o">&&</span> <span class=
"o">(
</span><span class=
"nx">child
</span><span class=
"o">.
</span><span class=
"nx">type
</span> <span class=
"o">===
</span> <span class=
"kc">undefined
</span><span class=
"o">))
</span> <span class=
"o">{
</span>
118 <span class=
"nx">child
</span><span class=
"o">.
</span><span class=
"nx">type
</span> <span class=
"o">=
</span> <span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">type
</span><span class=
"o">;
</span>
119 <span class=
"o">}
</span>
120 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">width
</span> <span class=
"o">&&</span> <span class=
"o">(
</span><span class=
"nx">child
</span><span class=
"o">.
</span><span class=
"nx">width
</span> <span class=
"o">===
</span> <span class=
"kc">undefined
</span><span class=
"o">))
</span> <span class=
"o">{
</span>
121 <span class=
"nx">child
</span><span class=
"o">.
</span><span class=
"nx">width
</span> <span class=
"o">=
</span> <span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">width
</span><span class=
"o">;
</span>
122 <span class=
"o">}
</span>
123 <span class=
"o">}
</span>
125 <span class=
"c">// Children increase colspan of the Column
</span>
126 <span class=
"c"></span> <span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">_colspan
</span> <span class=
"o">=
</span> <span class=
"nx">length
</span><span class=
"o">;
</span>
128 <span class=
"c">// Children increase colspan of the Column
's parent
</span>
129 <span class=
"c"></span> <span class=
"k">if
</span> <span class=
"o">(
</span><span class=
"nx">parent
</span> <span class=
"o">&&</span> <span class=
"nx">parent
</span><span class=
"o">.
</span><span class=
"nx">_colspan
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
130 <span class=
"nx">parent
</span><span class=
"o">.
</span><span class=
"nx">_colspan
</span> <span class=
"o">+=
</span> <span class=
"nx">length
</span><span class=
"o">-
</span><span class=
"m">1</span><span class=
"o">;
</span>
131 <span class=
"nx">parent
</span><span class=
"o">.
</span><span class=
"nx">_children
</span> <span class=
"o">=
</span> <span class=
"o">[];
</span>
132 <span class=
"nx">parent
</span><span class=
"o">.
</span><span class=
"nx">_children
</span><span class=
"o">.
</span><span class=
"nx">push
</span><span class=
"o">(
</span><span class=
"nx">oColumn
</span><span class=
"o">);
</span>
133 <span class=
"o">}
</span>
135 <span class=
"c">// Children must also be parsed
</span>
136 <span class=
"c"></span> <span class=
"k">if
</span><span class=
"o">(!
</span><span class=
"nx">tree
</span><span class=
"o">[
</span><span class=
"nx">nodelevel
</span><span class=
"o">+
</span><span class=
"m">1</span><span class=
"o">])
</span> <span class=
"o">{
</span>
137 <span class=
"nx">tree
</span><span class=
"o">[
</span><span class=
"nx">nodelevel
</span><span class=
"o">+
</span><span class=
"m">1</span><span class=
"o">]
</span> <span class=
"o">=
</span> <span class=
"o">[];
</span>
138 <span class=
"o">}
</span>
139 <span class=
"nx">parseColumns
</span><span class=
"o">(
</span><span class=
"nx">children
</span><span class=
"o">,
</span> <span class=
"nx">oColumn
</span><span class=
"o">);
</span>
140 <span class=
"o">}
</span>
142 <span class=
"c">// This Column does not have children,
</span>
143 <span class=
"c"></span> <span class=
"c">// but other Columns at this level do
</span>
144 <span class=
"c"></span> <span class=
"k">else
</span> <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">nodeLevelMaxChildren
</span> <span class=
"o">></span> <span class=
"m">0</span><span class=
"o">)
</span> <span class=
"o">{
</span>
145 <span class=
"c">// Children of siblings increase the rowspan of the Column
</span>
146 <span class=
"c"></span> <span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">_rowspan
</span> <span class=
"o">+=
</span> <span class=
"nx">nodeLevelMaxChildren
</span><span class=
"o">;
</span>
147 <span class=
"c">//if(oColumn.key) {
</span>
148 <span class=
"c"></span> <span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">_index
</span> <span class=
"o">=
</span> <span class=
"nx">keys
</span><span class=
"o">.
</span><span class=
"nx">length
</span><span class=
"o">;
</span>
149 <span class=
"nx">keys
</span><span class=
"o">.
</span><span class=
"nx">push
</span><span class=
"o">(
</span><span class=
"nx">oColumn
</span><span class=
"o">);
</span>
150 <span class=
"c">//}
</span>
151 <span class=
"c"></span> <span class=
"o">}
</span>
152 <span class=
"c">// This entire node level does not have any children
</span>
153 <span class=
"c"></span> <span class=
"k">else
</span> <span class=
"o">{
</span>
154 <span class=
"c">//if(oColumn.key) {
</span>
155 <span class=
"c"></span> <span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">_index
</span> <span class=
"o">=
</span> <span class=
"nx">keys
</span><span class=
"o">.
</span><span class=
"nx">length
</span><span class=
"o">;
</span>
156 <span class=
"nx">keys
</span><span class=
"o">.
</span><span class=
"nx">push
</span><span class=
"o">(
</span><span class=
"nx">oColumn
</span><span class=
"o">);
</span>
157 <span class=
"c">//}
</span>
158 <span class=
"c"></span> <span class=
"o">}
</span>
160 <span class=
"c">// Add the Column to the top-down tree
</span>
161 <span class=
"c"></span> <span class=
"nx">tree
</span><span class=
"o">[
</span><span class=
"nx">nodelevel
</span><span class=
"o">].
</span><span class=
"nx">push
</span><span class=
"o">(
</span><span class=
"nx">oColumn
</span><span class=
"o">);
</span>
162 <span class=
"o">}
</span>
163 <span class=
"nx">nodelevel
</span><span class=
"o">--;
</span>
164 <span class=
"o">};
</span>
166 <span class=
"c">// Do the parsing
</span>
167 <span class=
"c"></span> <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">aHeaders
</span><span class=
"o">.
</span><span class=
"nx">length
</span> <span class=
"o">></span> <span class=
"m">0</span><span class=
"o">)
</span> <span class=
"o">{
</span>
168 <span class=
"nx">parseColumns
</span><span class=
"o">(
</span><span class=
"nx">aHeaders
</span><span class=
"o">);
</span>
169 <span class=
"o">}
</span>
171 <span class=
"c">// Store header nesting in an array
</span>
172 <span class=
"c"></span> <span class=
"k">var
</span> <span class=
"nx">recurseAncestors
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">i
</span><span class=
"o">,
</span> <span class=
"nx">oColumn
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
173 <span class=
"nx">headers
</span><span class=
"o">[
</span><span class=
"nx">i
</span><span class=
"o">].
</span><span class=
"nx">push
</span><span class=
"o">(
</span><span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">_id
</span><span class=
"o">);
</span>
174 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">_parent
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
175 <span class=
"nx">recurseAncestors
</span><span class=
"o">(
</span><span class=
"nx">i
</span><span class=
"o">,
</span> <span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">_parent
</span><span class=
"o">);
</span>
176 <span class=
"o">}
</span>
177 <span class=
"o">};
</span>
178 <span class=
"k">for
</span><span class=
"o">(
</span><span class=
"k">var
</span> <span class=
"nx">i
</span><span class=
"o">=
</span><span class=
"m">0</span><span class=
"o">;
</span> <span class=
"nx">i
</span><span class=
"o"><</span><span class=
"nx">keys
</span><span class=
"o">.
</span><span class=
"nx">length
</span><span class=
"o">;
</span> <span class=
"nx">i
</span><span class=
"o">++)
</span> <span class=
"o">{
</span>
179 <span class=
"nx">headers
</span><span class=
"o">[
</span><span class=
"nx">i
</span><span class=
"o">]
</span> <span class=
"o">=
</span> <span class=
"o">[];
</span>
180 <span class=
"nx">recurseAncestors
</span><span class=
"o">(
</span><span class=
"nx">i
</span><span class=
"o">,
</span> <span class=
"nx">keys
</span><span class=
"o">[
</span><span class=
"nx">i
</span><span class=
"o">]);
</span>
181 <span class=
"nx">headers
</span><span class=
"o">[
</span><span class=
"nx">i
</span><span class=
"o">]
</span> <span class=
"o">=
</span> <span class=
"nx">headers
</span><span class=
"o">[
</span><span class=
"nx">i
</span><span class=
"o">].
</span><span class=
"nx">reverse
</span><span class=
"o">();
</span>
182 <span class=
"nx">headers
</span><span class=
"o">[
</span><span class=
"nx">i
</span><span class=
"o">]
</span> <span class=
"o">=
</span> <span class=
"nx">headers
</span><span class=
"o">[
</span><span class=
"nx">i
</span><span class=
"o">].
</span><span class=
"nx">join
</span><span class=
"o">(
</span><span class=
"s2">" "</span><span class=
"o">);
</span>
183 <span class=
"o">}
</span>
185 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">tree
</span> <span class=
"o">=
</span> <span class=
"nx">tree
</span><span class=
"o">;
</span>
186 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">flat
</span> <span class=
"o">=
</span> <span class=
"nx">flat
</span><span class=
"o">;
</span>
187 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">keys
</span> <span class=
"o">=
</span> <span class=
"nx">keys
</span><span class=
"o">;
</span>
188 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">headers
</span> <span class=
"o">=
</span> <span class=
"nx">headers
</span><span class=
"o">;
</span>
190 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnSet
</span><span class=
"o">.
</span><span class=
"nx">_nCount
</span><span class=
"o">++;
</span>
191 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">log
</span><span class=
"o">(
</span><span class=
"s2">"ColumnSet initialized
"</span><span class=
"o">,
</span> <span class=
"s2">"info
"</span><span class=
"o">,
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">toString
</span><span class=
"o">());
</span>
192 <span class=
"o">};
</span>
194 <span class=
"c">/////////////////////////////////////////////////////////////////////////////
</span>
195 <span class=
"c">//
</span>
196 <span class=
"c">// Public member variables
</span>
197 <span class=
"c">//
</span>
198 <span class=
"c">/////////////////////////////////////////////////////////////////////////////
</span>
199 <span class=
"c"></span>
200 <span class=
"c">/**
</span>
201 <span class=
"c"> * Internal class variable to index multiple data table instances.
</span>
202 <span class=
"c"> *
</span>
203 <span class=
"c"> * @property _nCount
</span>
204 <span class=
"c"> * @type number
</span>
205 <span class=
"c"> * @private
</span>
206 <span class=
"c"> * @static
</span>
207 <span class=
"c"> */
</span>
208 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnSet
</span><span class=
"o">.
</span><span class=
"nx">_nCount
</span> <span class=
"o">=
</span> <span class=
"m">0</span><span class=
"o">;
</span>
210 <span class=
"c">/**
</span>
211 <span class=
"c"> * Unique instance name.
</span>
212 <span class=
"c"> *
</span>
213 <span class=
"c"> * @property _sName
</span>
214 <span class=
"c"> * @type String
</span>
215 <span class=
"c"> * @private
</span>
216 <span class=
"c"> */
</span>
217 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnSet
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">_sName
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
219 <span class=
"c">/////////////////////////////////////////////////////////////////////////////
</span>
220 <span class=
"c">//
</span>
221 <span class=
"c">// Public member variables
</span>
222 <span class=
"c">//
</span>
223 <span class=
"c">/////////////////////////////////////////////////////////////////////////////
</span>
224 <span class=
"c"></span>
225 <span class=
"c">/**
</span>
226 <span class=
"c"> * Top-down tree representation of Column hierarchy.
</span>
227 <span class=
"c"> *
</span>
228 <span class=
"c"> * @property tree
</span>
229 <span class=
"c"> * @type YAHOO.widget.Column[]
</span>
230 <span class=
"c"> */
</span>
231 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnSet
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">tree
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
233 <span class=
"c">/**
</span>
234 <span class=
"c"> * Flattened representation of all Columns.
</span>
235 <span class=
"c"> *
</span>
236 <span class=
"c"> * @property flat
</span>
237 <span class=
"c"> * @type YAHOO.widget.Column[]
</span>
238 <span class=
"c"> * @default []
</span>
239 <span class=
"c"> */
</span>
240 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnSet
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">flat
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
242 <span class=
"c">/**
</span>
243 <span class=
"c"> * Array of Columns that map one-to-one to a table column.
</span>
244 <span class=
"c"> *
</span>
245 <span class=
"c"> * @property keys
</span>
246 <span class=
"c"> * @type YAHOO.widget.Column[]
</span>
247 <span class=
"c"> * @default []
</span>
248 <span class=
"c"> */
</span>
249 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnSet
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">keys
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
251 <span class=
"c">/**
</span>
252 <span class=
"c"> * ID index of nested parent heirarchies for HEADERS accessibility attribute.
</span>
253 <span class=
"c"> *
</span>
254 <span class=
"c"> * @property headers
</span>
255 <span class=
"c"> * @type String[]
</span>
256 <span class=
"c"> * @default []
</span>
257 <span class=
"c"> */
</span>
258 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnSet
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">headers
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
260 <span class=
"c">/////////////////////////////////////////////////////////////////////////////
</span>
261 <span class=
"c">//
</span>
262 <span class=
"c">// Public methods
</span>
263 <span class=
"c">//
</span>
264 <span class=
"c">/////////////////////////////////////////////////////////////////////////////
</span>
265 <span class=
"c"></span>
266 <span class=
"c">/**
</span>
267 <span class=
"c"> * Public accessor to the unique name of the ColumnSet instance.
</span>
268 <span class=
"c"> *
</span>
269 <span class=
"c"> * @method toString
</span>
270 <span class=
"c"> * @return {String} Unique name of the ColumnSet instance.
</span>
271 <span class=
"c"> */
</span>
273 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnSet
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">toString
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">()
</span> <span class=
"o">{
</span>
274 <span class=
"k">return
</span> <span class=
"s2">"ColumnSet
"</span> <span class=
"o">+
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">_sName
</span><span class=
"o">;
</span>
275 <span class=
"o">};
</span>
277 <span class=
"c">/****************************************************************************/
</span>
278 <span class=
"c">/****************************************************************************/
</span>
279 <span class=
"c">/****************************************************************************/
</span>
281 <span class=
"c">/**
</span>
282 <span class=
"c"> * The Column class defines and manages attributes of DataTable Columns
</span>
283 <span class=
"c"> *
</span>
284 <span class=
"c"> *
</span>
285 <span class=
"c"> * @class Column
</span>
286 <span class=
"c"> * @constructor
</span>
287 <span class=
"c"> * @param oConfigs {Object} Object literal of configuration values.
</span>
288 <span class=
"c"> */
</span>
289 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">oConfigs
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
290 <span class=
"c">// Internal variables
</span>
291 <span class=
"c"></span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">_id
</span> <span class=
"o">=
</span> <span class=
"s2">"yui-dtcol
"</span><span class=
"o">+
</span><span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">_nCount
</span><span class=
"o">;
</span>
293 <span class=
"c">// Object literal defines Column attributes
</span>
294 <span class=
"c"></span> <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"k">typeof
</span> <span class=
"nx">oConfigs
</span> <span class=
"o">==
</span> <span class=
"s2">"object
"</span><span class=
"o">)
</span> <span class=
"o">{
</span>
295 <span class=
"k">for
</span><span class=
"o">(
</span><span class=
"k">var
</span> <span class=
"nx">sConfig
</span> <span class=
"k">in
</span> <span class=
"nx">oConfigs
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
296 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">sConfig
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
297 <span class=
"k">this
</span><span class=
"o">[
</span><span class=
"nx">sConfig
</span><span class=
"o">]
</span> <span class=
"o">=
</span> <span class=
"nx">oConfigs
</span><span class=
"o">[
</span><span class=
"nx">sConfig
</span><span class=
"o">];
</span>
298 <span class=
"o">}
</span>
299 <span class=
"o">}
</span>
300 <span class=
"o">}
</span>
302 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">_nCount
</span><span class=
"o">++;
</span>
303 <span class=
"o">};
</span>
305 <span class=
"c">/////////////////////////////////////////////////////////////////////////////
</span>
306 <span class=
"c">//
</span>
307 <span class=
"c">// Private member variables
</span>
308 <span class=
"c">//
</span>
309 <span class=
"c">/////////////////////////////////////////////////////////////////////////////
</span>
310 <span class=
"c"></span>
311 <span class=
"c">/**
</span>
312 <span class=
"c"> * Internal instance counter.
</span>
313 <span class=
"c"> *
</span>
314 <span class=
"c"> * @property _nCount
</span>
315 <span class=
"c"> * @type Number
</span>
316 <span class=
"c"> * @static
</span>
317 <span class=
"c"> * @default
0</span>
318 <span class=
"c"> */
</span>
319 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">_nCount
</span> <span class=
"o">=
</span> <span class=
"m">0</span><span class=
"o">;
</span>
322 <span class=
"c">/**
</span>
323 <span class=
"c"> * Unique ID, also assigned as DOM ID.
</span>
324 <span class=
"c"> *
</span>
325 <span class=
"c"> * @property _id
</span>
326 <span class=
"c"> * @type String
</span>
327 <span class=
"c"> * @private
</span>
328 <span class=
"c"> */
</span>
329 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">_id
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
331 <span class=
"c">/**
</span>
332 <span class=
"c"> * Reference to Column
's index within its ColumnSet
's key array, or null if not applicable.
</span>
333 <span class=
"c"> *
</span>
334 <span class=
"c"> * @property _index
</span>
335 <span class=
"c"> * @type Number
</span>
336 <span class=
"c"> * @private
</span>
337 <span class=
"c"> */
</span>
338 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">_index
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
340 <span class=
"c">/**
</span>
341 <span class=
"c"> * Number of table cells the Column spans.
</span>
342 <span class=
"c"> *
</span>
343 <span class=
"c"> * @property _colspan
</span>
344 <span class=
"c"> * @type Number
</span>
345 <span class=
"c"> * @private
</span>
346 <span class=
"c"> */
</span>
347 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">_colspan
</span> <span class=
"o">=
</span> <span class=
"m">1</span><span class=
"o">;
</span>
349 <span class=
"c">/**
</span>
350 <span class=
"c"> * Number of table rows the Column spans.
</span>
351 <span class=
"c"> *
</span>
352 <span class=
"c"> * @property _rowspan
</span>
353 <span class=
"c"> * @type Number
</span>
354 <span class=
"c"> * @private
</span>
355 <span class=
"c"> */
</span>
356 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">_rowspan
</span> <span class=
"o">=
</span> <span class=
"m">1</span><span class=
"o">;
</span>
358 <span class=
"c">/**
</span>
359 <span class=
"c"> * Column
's parent, or null.
</span>
360 <span class=
"c"> *
</span>
361 <span class=
"c"> * @property _parent
</span>
362 <span class=
"c"> * @type YAHOO.widget.Column
</span>
363 <span class=
"c"> * @private
</span>
364 <span class=
"c"> */
</span>
365 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">_parent
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
367 <span class=
"c">/**
</span>
368 <span class=
"c"> * Array of Column
's chilren, or null.
</span>
369 <span class=
"c"> *
</span>
370 <span class=
"c"> * @property _children
</span>
371 <span class=
"c"> * @type YAHOO.widget.Column[]
</span>
372 <span class=
"c"> * @private
</span>
373 <span class=
"c"> */
</span>
374 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">_children
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
376 <span class=
"c">//TODO: clean these up
</span>
377 <span class=
"c"></span>
378 <span class=
"c">/**
</span>
379 <span class=
"c"> * Current offsetWidth of the Column (in pixels).
</span>
380 <span class=
"c"> *
</span>
381 <span class=
"c"> * @property _width
</span>
382 <span class=
"c"> * @type Number
</span>
383 <span class=
"c"> * @private
</span>
384 <span class=
"c"> */
</span>
385 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">_width
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
387 <span class=
"c">/**
</span>
388 <span class=
"c"> * Minimum width the Column can support (in pixels). Value is populated only if table
</span>
389 <span class=
"c"> * is fixedwidth, null otherwise.
</span>
390 <span class=
"c"> *
</span>
391 <span class=
"c"> * @property _minWidth
</span>
392 <span class=
"c"> * @type Number
</span>
393 <span class=
"c"> * @private
</span>
394 <span class=
"c"> */
</span>
395 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">_minWidth
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
397 <span class=
"c">/////////////////////////////////////////////////////////////////////////////
</span>
398 <span class=
"c">//
</span>
399 <span class=
"c">// Public member variables
</span>
400 <span class=
"c">//
</span>
401 <span class=
"c">/////////////////////////////////////////////////////////////////////////////
</span>
402 <span class=
"c"></span>
403 <span class=
"c">/**
</span>
404 <span class=
"c"> * Associated database field, or null.
</span>
405 <span class=
"c"> *
</span>
406 <span class=
"c"> * @property key
</span>
407 <span class=
"c"> * @type String
</span>
408 <span class=
"c"> */
</span>
409 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">key
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
411 <span class=
"c">/**
</span>
412 <span class=
"c"> * Text or HTML for display in Column
's assocated TH element.
</span>
413 <span class=
"c"> *
</span>
414 <span class=
"c"> * @property text
</span>
415 <span class=
"c"> * @type String
</span>
416 <span class=
"c"> */
</span>
417 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">text
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
419 <span class=
"c">/**
</span>
420 <span class=
"c"> * Data types:
"string
",
"number
",
"date
",
"currency
",
"checkbox
",
"select
",
</span>
421 <span class=
"c"> *
"email
",
"link
".
</span>
422 <span class=
"c"> *
</span>
423 <span class=
"c"> * @property type
</span>
424 <span class=
"c"> * @type String
</span>
425 <span class=
"c"> * @default
"string
"</span>
426 <span class=
"c"> */
</span>
427 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">type
</span> <span class=
"o">=
</span> <span class=
"s2">"string
"</span><span class=
"o">;
</span>
429 <span class=
"c">/**
</span>
430 <span class=
"c"> * Column head cell ABBR for accessibility.
</span>
431 <span class=
"c"> *
</span>
432 <span class=
"c"> * @property abbr
</span>
433 <span class=
"c"> * @type String
</span>
434 <span class=
"c"> */
</span>
435 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">abbr
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
437 <span class=
"c">/**
</span>
438 <span class=
"c"> * Array of object literals that define children (nested headers) of a Column.
</span>
439 <span class=
"c"> *
</span>
440 <span class=
"c"> * @property children
</span>
441 <span class=
"c"> * @type Object[]
</span>
442 <span class=
"c"> */
</span>
443 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">children
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
445 <span class=
"c">/**
</span>
446 <span class=
"c"> * Column width.
</span>
447 <span class=
"c"> *
</span>
448 <span class=
"c"> * @property width
</span>
449 <span class=
"c"> * @type String
</span>
450 <span class=
"c"> */
</span>
451 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">width
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
453 <span class=
"c">/**
</span>
454 <span class=
"c"> * Custom CSS class to be applied to every cell in the Column.
</span>
455 <span class=
"c"> *
</span>
456 <span class=
"c"> * @property className
</span>
457 <span class=
"c"> * @type String
</span>
458 <span class=
"c"> */
</span>
459 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">className
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
461 <span class=
"c">/**
</span>
462 <span class=
"c"> * Defines a custom format function for Column, otherwise default is used,
</span>
463 <span class=
"c"> * according to Column type.
</span>
464 <span class=
"c"> *
</span>
465 <span class=
"c"> * @property formatter
</span>
466 <span class=
"c"> * @type HTMLFunction
</span>
467 <span class=
"c"> */
</span>
468 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">formatter
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
470 <span class=
"c">/**
</span>
471 <span class=
"c"> * Defines a custom parse function for Column, otherwise default is used,
</span>
472 <span class=
"c"> * according to Column type.
</span>
473 <span class=
"c"> *
</span>
474 <span class=
"c"> * @property parser
</span>
475 <span class=
"c"> * @type HTMLFunction
</span>
476 <span class=
"c"> */
</span>
477 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">parser
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
479 <span class=
"c">/**
</span>
480 <span class=
"c"> * Defines the type of editor for Column, otherwise Column is not editable.
</span>
481 <span class=
"c"> *
</span>
482 <span class=
"c"> * @property editor
</span>
483 <span class=
"c"> * @type String
</span>
484 <span class=
"c"> */
</span>
485 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">editor
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
487 <span class=
"c">/**
</span>
488 <span class=
"c"> * True if Column is resizeable, false otherwise.
</span>
489 <span class=
"c"> *
</span>
490 <span class=
"c"> * @property resizeable
</span>
491 <span class=
"c"> * @type Boolean
</span>
492 <span class=
"c"> * @default false
</span>
493 <span class=
"c"> */
</span>
494 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">resizeable
</span> <span class=
"o">=
</span> <span class=
"kc">false
</span><span class=
"o">;
</span>
496 <span class=
"c">/**
</span>
497 <span class=
"c"> * True if Column is sortable, false otherwise.
</span>
498 <span class=
"c"> *
</span>
499 <span class=
"c"> * @property sortable
</span>
500 <span class=
"c"> * @type Boolean
</span>
501 <span class=
"c"> * @default false
</span>
502 <span class=
"c"> */
</span>
503 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">sortable
</span> <span class=
"o">=
</span> <span class=
"kc">false
</span><span class=
"o">;
</span>
505 <span class=
"c">/**
</span>
506 <span class=
"c"> * Custom sort handler to arrange Column in descending order.
</span>
507 <span class=
"c"> *
</span>
508 <span class=
"c"> * @property sortOptions.descFunction
</span>
509 <span class=
"c"> * @type Function
</span>
510 <span class=
"c"> * @default null
</span>
511 <span class=
"c"> */
</span>
512 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">descFunction
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
514 <span class=
"c">/**
</span>
515 <span class=
"c"> * Custom sort handler to arrange Column in ascending order.
</span>
516 <span class=
"c"> *
</span>
517 <span class=
"c"> * @property sortOptions.ascFunction
</span>
518 <span class=
"c"> * @type Function
</span>
519 <span class=
"c"> * @default null
</span>
520 <span class=
"c"> */
</span>
521 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">ascFunction
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
537 <span class=
"c">/////////////////////////////////////////////////////////////////////////////
</span>
538 <span class=
"c">//
</span>
539 <span class=
"c">// Public methods
</span>
540 <span class=
"c">//
</span>
541 <span class=
"c">/////////////////////////////////////////////////////////////////////////////
</span>
542 <span class=
"c"></span>
543 <span class=
"c">/**
</span>
544 <span class=
"c"> * Public accessor returns Column
's ID string.
</span>
545 <span class=
"c"> *
</span>
546 <span class=
"c"> * @method getId
</span>
547 <span class=
"c"> * @return {String} Column
's ID string.
</span>
548 <span class=
"c"> */
</span>
549 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">getId
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">()
</span> <span class=
"o">{
</span>
550 <span class=
"k">return
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">_id
</span><span class=
"o">;
</span>
551 <span class=
"o">};
</span>
553 <span class=
"c">/**
</span>
554 <span class=
"c"> * Public accessor returns Column
's colspan number.
</span>
555 <span class=
"c"> *
</span>
556 <span class=
"c"> * @method getColSpan
</span>
557 <span class=
"c"> * @return {Number} Column
's colspan number.
</span>
558 <span class=
"c"> */
</span>
559 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">getColSpan
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">()
</span> <span class=
"o">{
</span>
560 <span class=
"k">return
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">_colspan
</span><span class=
"o">;
</span>
561 <span class=
"o">};
</span>
563 <span class=
"c">/**
</span>
564 <span class=
"c"> * Public accessor returns Column
's rowspan number.
</span>
565 <span class=
"c"> *
</span>
566 <span class=
"c"> * @method getRowSpan
</span>
567 <span class=
"c"> * @return {Number} Column
's rowspan number.
</span>
568 <span class=
"c"> */
</span>
569 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">getRowSpan
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">()
</span> <span class=
"o">{
</span>
570 <span class=
"k">return
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">_rowspan
</span><span class=
"o">;
</span>
571 <span class=
"o">};
</span>
574 <span class=
"c">/**
</span>
575 <span class=
"c"> * Outputs markup into the given TD based on given Record.
</span>
576 <span class=
"c"> *
</span>
577 <span class=
"c"> * @method format
</span>
578 <span class=
"c"> * @param elCell {HTMLElement} TD to format for display.
</span>
579 <span class=
"c"> * @param oRecord {YAHOO.widget.Record} Record that holds data for the row.
</span>
580 <span class=
"c"> * @return {HTML} Markup.
</span>
581 <span class=
"c"> */
</span>
582 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">format
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span><span class=
"nx">oRecord
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
583 <span class=
"k">var
</span> <span class=
"nx">oData
</span> <span class=
"o">=
</span> <span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">key
</span><span class=
"o">)
</span> <span class=
"o">?
</span> <span class=
"nx">oRecord
</span><span class=
"o">[
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">key
</span><span class=
"o">]
</span> <span class=
"o">:
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
584 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">formatter
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
585 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">formatter
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">,
</span> <span class=
"k">this
</span><span class=
"o">,
</span> <span class=
"nx">oData
</span><span class=
"o">);
</span>
586 <span class=
"o">}
</span>
587 <span class=
"k">else
</span> <span class=
"o">{
</span>
588 <span class=
"k">var
</span> <span class=
"nx">type
</span> <span class=
"o">=
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">type
</span><span class=
"o">;
</span>
589 <span class=
"k">var
</span> <span class=
"nx">markup
</span> <span class=
"o">=
</span> <span class=
"s2">""</span><span class=
"o">;
</span>
590 <span class=
"k">var
</span> <span class=
"nx">classname
</span> <span class=
"o">=
</span> <span class=
"s2">""</span><span class=
"o">;
</span>
591 <span class=
"nx">switch
</span><span class=
"o">(
</span><span class=
"nx">type
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
592 <span class=
"nx">case
</span> <span class=
"s2">"checkbox
"</span><span class=
"o">:
</span>
593 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">formatCheckbox
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">,
</span> <span class=
"k">this
</span><span class=
"o">,
</span> <span class=
"nx">oData
</span><span class=
"o">);
</span>
594 <span class=
"nx">classname
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">DataTable
</span><span class=
"o">.
</span><span class=
"nx">CLASS_CHECKBOX
</span><span class=
"o">;
</span>
595 <span class=
"k">break
</span><span class=
"o">;
</span>
596 <span class=
"nx">case
</span> <span class=
"s2">"currency
"</span><span class=
"o">:
</span>
597 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">formatCurrency
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">,
</span> <span class=
"k">this
</span><span class=
"o">,
</span> <span class=
"nx">oData
</span><span class=
"o">);
</span>
598 <span class=
"nx">classname
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">DataTable
</span><span class=
"o">.
</span><span class=
"nx">CLASS_CURRENCY
</span><span class=
"o">;
</span>
599 <span class=
"k">break
</span><span class=
"o">;
</span>
600 <span class=
"nx">case
</span> <span class=
"s2">"date
"</span><span class=
"o">:
</span>
601 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">formatDate
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">,
</span> <span class=
"k">this
</span><span class=
"o">,
</span> <span class=
"nx">oData
</span><span class=
"o">);
</span>
602 <span class=
"nx">classname
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">DataTable
</span><span class=
"o">.
</span><span class=
"nx">CLASS_DATE
</span><span class=
"o">;
</span>
603 <span class=
"k">break
</span><span class=
"o">;
</span>
604 <span class=
"nx">case
</span> <span class=
"s2">"email
"</span><span class=
"o">:
</span>
605 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">formatEmail
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">,
</span> <span class=
"k">this
</span><span class=
"o">,
</span> <span class=
"nx">oData
</span><span class=
"o">);
</span>
606 <span class=
"nx">classname
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">DataTable
</span><span class=
"o">.
</span><span class=
"nx">CLASS_EMAIL
</span><span class=
"o">;
</span>
607 <span class=
"k">break
</span><span class=
"o">;
</span>
608 <span class=
"nx">case
</span> <span class=
"s2">"link
"</span><span class=
"o">:
</span>
609 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">formatLink
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">,
</span> <span class=
"k">this
</span><span class=
"o">,
</span> <span class=
"nx">oData
</span><span class=
"o">);
</span>
610 <span class=
"nx">classname
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">DataTable
</span><span class=
"o">.
</span><span class=
"nx">CLASS_LINK
</span><span class=
"o">;
</span>
611 <span class=
"k">break
</span><span class=
"o">;
</span>
612 <span class=
"nx">case
</span> <span class=
"s2">"number
"</span><span class=
"o">:
</span>
613 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">formatNumber
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">,
</span> <span class=
"k">this
</span><span class=
"o">,
</span> <span class=
"nx">oData
</span><span class=
"o">);
</span>
614 <span class=
"nx">classname
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">DataTable
</span><span class=
"o">.
</span><span class=
"nx">CLASS_NUMBER
</span><span class=
"o">;
</span>
615 <span class=
"k">break
</span><span class=
"o">;
</span>
616 <span class=
"nx">case
</span> <span class=
"s2">"select
"</span><span class=
"o">:
</span>
617 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">formatSelect
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">,
</span> <span class=
"k">this
</span><span class=
"o">,
</span> <span class=
"nx">oData
</span><span class=
"o">);
</span>
618 <span class=
"nx">classname
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">DataTable
</span><span class=
"o">.
</span><span class=
"nx">CLASS_SELECT
</span><span class=
"o">;
</span>
619 <span class=
"k">break
</span><span class=
"o">;
</span>
620 <span class=
"nx">default
</span><span class=
"o">:
</span>
621 <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">innerHTML
</span> <span class=
"o">=
</span> <span class=
"o">(
</span><span class=
"nx">oData
</span><span class=
"o">)
</span> <span class=
"o">?
</span> <span class=
"nx">oData
</span><span class=
"o">.
</span><span class=
"nx">toString
</span><span class=
"o">()
</span> <span class=
"o">:
</span> <span class=
"s2">""</span><span class=
"o">;
</span>
622 <span class=
"c">//elCell.innerHTML = (oData) ?
"<a href=\
"#\
">"+oData.toString()+
"</a
>" :
"";
</span>
623 <span class=
"c"></span> <span class=
"nx">classname
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">DataTable
</span><span class=
"o">.
</span><span class=
"nx">CLASS_STRING
</span><span class=
"o">;
</span>
624 <span class=
"k">break
</span><span class=
"o">;
</span>
625 <span class=
"o">}
</span>
627 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Dom
</span><span class=
"o">.
</span><span class=
"nx">addClass
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">classname
</span><span class=
"o">);
</span>
628 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">className
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
629 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Dom
</span><span class=
"o">.
</span><span class=
"nx">addClass
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">className
</span><span class=
"o">);
</span>
630 <span class=
"o">}
</span>
631 <span class=
"o">}
</span>
633 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">editor
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
634 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Dom
</span><span class=
"o">.
</span><span class=
"nx">addClass
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span><span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">DataTable
</span><span class=
"o">.
</span><span class=
"nx">CLASS_EDITABLE
</span><span class=
"o">);
</span>
635 <span class=
"o">}
</span>
636 <span class=
"o">};
</span>
639 <span class=
"c">/**
</span>
640 <span class=
"c"> * Formats cells in Columns of type
"checkbox
".
</span>
641 <span class=
"c"> *
</span>
642 <span class=
"c"> * @method formatCheckbox
</span>
643 <span class=
"c"> * @param elCell {HTMLElement} Table cell element.
</span>
644 <span class=
"c"> * @param oRecord {YAHOO.widget.Record} Record instance.
</span>
645 <span class=
"c"> * @param oColumn {YAHOO.widget.Column} Column instance.
</span>
646 <span class=
"c"> * @param oData {Object} Data value for the cell, or null
</span>
647 <span class=
"c"> * @static
</span>
648 <span class=
"c"> */
</span>
649 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">formatCheckbox
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">,
</span> <span class=
"nx">oColumn
</span><span class=
"o">,
</span> <span class=
"nx">oData
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
650 <span class=
"k">var
</span> <span class=
"nx">bChecked
</span> <span class=
"o">=
</span> <span class=
"nx">oData
</span><span class=
"o">;
</span>
651 <span class=
"nx">bChecked
</span> <span class=
"o">=
</span> <span class=
"o">(
</span><span class=
"nx">bChecked
</span><span class=
"o">)
</span> <span class=
"o">?
</span> <span class=
"s2">" checked
"</span> <span class=
"o">:
</span> <span class=
"s2">""</span><span class=
"o">;
</span>
652 <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">innerHTML
</span> <span class=
"o">=
</span> <span class=
"s2">"<input type=\
"checkbox\
""</span> <span class=
"o">+
</span> <span class=
"nx">bChecked
</span> <span class=
"o">+
</span>
653 <span class=
"s2">" class=\
""</span> <span class=
"o">+
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">DataTable
</span><span class=
"o">.
</span><span class=
"nx">CLASS_CHECKBOX
</span> <span class=
"o">+
</span> <span class=
"s2">"\
">"</span><span class=
"o">;
</span>
654 <span class=
"o">};
</span>
656 <span class=
"c">/**
</span>
657 <span class=
"c"> * Formats cells in Columns of type
"currency
". Can be overridden for custom formatting.
</span>
658 <span class=
"c"> *
</span>
659 <span class=
"c"> * @method formatCurrency
</span>
660 <span class=
"c"> * @param elCell {HTMLElement} Table cell element.
</span>
661 <span class=
"c"> * @param oRecord {YAHOO.widget.Record} Record instance.
</span>
662 <span class=
"c"> * @param oColumn {YAHOO.widget.Column} Column instance.
</span>
663 <span class=
"c"> * @param oData {Object} Data value for the cell, or null
</span>
664 <span class=
"c"> * @static
</span>
665 <span class=
"c"> */
</span>
666 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">formatCurrency
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">,
</span> <span class=
"nx">oColumn
</span><span class=
"o">,
</span> <span class=
"nx">oData
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
667 <span class=
"c">// Make it dollars
</span>
668 <span class=
"c"></span> <span class=
"k">var
</span> <span class=
"nx">nAmount
</span> <span class=
"o">=
</span> <span class=
"nx">oData
</span><span class=
"o">;
</span>
669 <span class=
"k">var
</span> <span class=
"nx">markup
</span><span class=
"o">;
</span>
670 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">nAmount
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
671 <span class=
"nx">markup
</span> <span class=
"o">=
</span> <span class=
"s2">"$
"</span><span class=
"o">+
</span><span class=
"nx">nAmount
</span><span class=
"o">;
</span>
673 <span class=
"c">// Normalize to the penny
</span>
674 <span class=
"c"></span> <span class=
"k">var
</span> <span class=
"nx">dotIndex
</span> <span class=
"o">=
</span> <span class=
"nx">markup
</span><span class=
"o">.
</span><span class=
"nx">indexOf
</span><span class=
"o">(
</span><span class=
"s2">".
"</span><span class=
"o">);
</span>
675 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">dotIndex
</span> <span class=
"o"><</span> <span class=
"m">0</span><span class=
"o">)
</span> <span class=
"o">{
</span>
676 <span class=
"nx">markup
</span> <span class=
"o">+=
</span> <span class=
"s2">".00"</span><span class=
"o">;
</span>
677 <span class=
"o">}
</span>
678 <span class=
"k">else
</span> <span class=
"o">{
</span>
679 <span class=
"k">while
</span><span class=
"o">(
</span><span class=
"nx">dotIndex
</span> <span class=
"o">!=
</span> <span class=
"nx">markup
</span><span class=
"o">.
</span><span class=
"nx">length
</span><span class=
"o">-
</span><span class=
"m">3</span><span class=
"o">)
</span> <span class=
"o">{
</span>
680 <span class=
"nx">markup
</span> <span class=
"o">+=
</span> <span class=
"s2">"0"</span><span class=
"o">;
</span>
681 <span class=
"o">}
</span>
682 <span class=
"o">}
</span>
683 <span class=
"o">}
</span>
684 <span class=
"k">else
</span> <span class=
"o">{
</span>
685 <span class=
"nx">markup
</span> <span class=
"o">=
</span> <span class=
"s2">""</span><span class=
"o">;
</span>
686 <span class=
"o">}
</span>
687 <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">innerHTML
</span> <span class=
"o">=
</span> <span class=
"nx">markup
</span><span class=
"o">;
</span>
688 <span class=
"o">};
</span>
690 <span class=
"c">/**
</span>
691 <span class=
"c"> * Formats cells in Columns of type
"date
".
</span>
692 <span class=
"c"> *
</span>
693 <span class=
"c"> * @method formatDate
</span>
694 <span class=
"c"> * @param elCell {HTMLElement} Table cell element.
</span>
695 <span class=
"c"> * @param oRecord {YAHOO.widget.Record} Record instance.
</span>
696 <span class=
"c"> * @param oColumn {YAHOO.widget.Column} Column instance.
</span>
697 <span class=
"c"> * @param oData {Object} Data value for the cell, or null
</span>
698 <span class=
"c"> * @static
</span>
699 <span class=
"c"> */
</span>
700 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">formatDate
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">,
</span> <span class=
"nx">oColumn
</span><span class=
"o">,
</span> <span class=
"nx">oData
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
701 <span class=
"k">var
</span> <span class=
"nx">oDate
</span> <span class=
"o">=
</span> <span class=
"nx">oData
</span><span class=
"o">;
</span>
702 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">oDate
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
703 <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">innerHTML
</span> <span class=
"o">=
</span> <span class=
"nx">oDate
</span><span class=
"o">.
</span><span class=
"nx">getMonth
</span><span class=
"o">()
</span> <span class=
"o">+
</span> <span class=
"s2">"/
"</span> <span class=
"o">+
</span> <span class=
"nx">oDate
</span><span class=
"o">.
</span><span class=
"nx">getDate
</span><span class=
"o">()
</span> <span class=
"o">+
</span> <span class=
"s2">"/
"</span> <span class=
"o">+
</span> <span class=
"nx">oDate
</span><span class=
"o">.
</span><span class=
"nx">getFullYear
</span><span class=
"o">();
</span>
704 <span class=
"o">}
</span>
705 <span class=
"k">else
</span> <span class=
"o">{
</span>
706 <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">innerHTML
</span> <span class=
"o">=
</span> <span class=
"s2">""</span><span class=
"o">;
</span>
707 <span class=
"o">}
</span>
708 <span class=
"o">};
</span>
710 <span class=
"c">/**
</span>
711 <span class=
"c"> * Formats cells in Columns of type
"email
".
</span>
712 <span class=
"c"> *
</span>
713 <span class=
"c"> * @method formatEmail
</span>
714 <span class=
"c"> * @param elCell {HTMLElement} Table cell element.
</span>
715 <span class=
"c"> * @param oRecord {YAHOO.widget.Record} Record instance.
</span>
716 <span class=
"c"> * @param oColumn {YAHOO.widget.Column} Column instance.
</span>
717 <span class=
"c"> * @param oData {Object} Data value for the cell, or null
</span>
718 <span class=
"c"> * @static
</span>
719 <span class=
"c"> */
</span>
720 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">formatEmail
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">,
</span> <span class=
"nx">oColumn
</span><span class=
"o">,
</span> <span class=
"nx">oData
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
721 <span class=
"k">var
</span> <span class=
"nx">sEmail
</span> <span class=
"o">=
</span> <span class=
"nx">oData
</span><span class=
"o">;
</span>
722 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">sEmail
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
723 <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">innerHTML
</span> <span class=
"o">=
</span> <span class=
"s2">"<a href=\
"mailto:
"</span> <span class=
"o">+
</span> <span class=
"nx">sEmail
</span> <span class=
"o">+
</span> <span class=
"s2">"\
">"</span> <span class=
"o">+
</span> <span class=
"nx">sEmail
</span> <span class=
"o">+
</span> <span class=
"s2">"</a
>"</span><span class=
"o">;
</span>
724 <span class=
"o">}
</span>
725 <span class=
"k">else
</span> <span class=
"o">{
</span>
726 <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">innerHTML
</span> <span class=
"o">=
</span> <span class=
"s2">""</span><span class=
"o">;
</span>
727 <span class=
"o">}
</span>
728 <span class=
"o">};
</span>
730 <span class=
"c">/**
</span>
731 <span class=
"c"> * Formats cells in Columns of type
"link
".
</span>
732 <span class=
"c"> *
</span>
733 <span class=
"c"> * @method formatLink
</span>
734 <span class=
"c"> * @param elCell {HTMLElement} Table cell element.
</span>
735 <span class=
"c"> * @param oRecord {YAHOO.widget.Record} Record instance.
</span>
736 <span class=
"c"> * @param oColumn {YAHOO.widget.Column} Column instance.
</span>
737 <span class=
"c"> * @param oData {Object} Data value for the cell, or null
</span>
738 <span class=
"c"> * @static
</span>
739 <span class=
"c"> */
</span>
740 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">formatLink
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">,
</span> <span class=
"nx">oColumn
</span><span class=
"o">,
</span> <span class=
"nx">oData
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
741 <span class=
"k">var
</span> <span class=
"nx">sLink
</span> <span class=
"o">=
</span> <span class=
"nx">oData
</span><span class=
"o">;
</span>
742 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">sLink
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
743 <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">innerHTML
</span> <span class=
"o">=
</span> <span class=
"s2">"<a href=\
""</span> <span class=
"o">+
</span> <span class=
"nx">sLink
</span> <span class=
"o">+
</span> <span class=
"s2">"\
">"</span> <span class=
"o">+
</span> <span class=
"nx">sLink
</span> <span class=
"o">+
</span> <span class=
"s2">"</a
>"</span><span class=
"o">;
</span>
744 <span class=
"o">}
</span>
745 <span class=
"k">else
</span> <span class=
"o">{
</span>
746 <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">innerHTML
</span> <span class=
"o">=
</span> <span class=
"s2">""</span><span class=
"o">;
</span>
747 <span class=
"o">}
</span>
748 <span class=
"o">};
</span>
750 <span class=
"c">/**
</span>
751 <span class=
"c"> * Formats cells in Columns of type
"number
".
</span>
752 <span class=
"c"> *
</span>
753 <span class=
"c"> * @method formatNumber
</span>
754 <span class=
"c"> * @param elCell {HTMLElement} Table cell element.
</span>
755 <span class=
"c"> * @param oRecord {YAHOO.widget.Record} Record instance.
</span>
756 <span class=
"c"> * @param oColumn {YAHOO.widget.Column} Column instance.
</span>
757 <span class=
"c"> * @param oData {Object} Data value for the cell, or null
</span>
758 <span class=
"c"> * @static
</span>
759 <span class=
"c"> */
</span>
760 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">formatNumber
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">,
</span> <span class=
"nx">oColumn
</span><span class=
"o">,
</span> <span class=
"nx">oData
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
761 <span class=
"k">var
</span> <span class=
"nx">nNumber
</span> <span class=
"o">=
</span> <span class=
"nx">oData
</span><span class=
"o">;
</span>
762 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">nNumber
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
763 <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">innerHTML
</span> <span class=
"o">=
</span> <span class=
"nx">nNumber
</span><span class=
"o">.
</span><span class=
"nx">toString
</span><span class=
"o">();
</span>
764 <span class=
"o">}
</span>
765 <span class=
"k">else
</span> <span class=
"o">{
</span>
766 <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">innerHTML
</span> <span class=
"o">=
</span> <span class=
"s2">""</span><span class=
"o">;
</span>
767 <span class=
"o">}
</span>
768 <span class=
"o">};
</span>
770 <span class=
"c">/**
</span>
771 <span class=
"c"> * Formats cells in Columns of type
"select
".
</span>
772 <span class=
"c"> *
</span>
773 <span class=
"c"> * @method formatSelect
</span>
774 <span class=
"c"> * @param elCell {HTMLElement} Table cell element.
</span>
775 <span class=
"c"> * @param oRecord {YAHOO.widget.Record} Record instance.
</span>
776 <span class=
"c"> * @param oColumn {YAHOO.widget.Column} Column instance.
</span>
777 <span class=
"c"> * @param oData {Object} Data value for the cell, or null
</span>
778 <span class=
"c"> * @static
</span>
779 <span class=
"c"> */
</span>
780 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">formatSelect
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">,
</span> <span class=
"nx">oColumn
</span><span class=
"o">,
</span> <span class=
"nx">oData
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
781 <span class=
"k">var
</span> <span class=
"nx">selectedValue
</span> <span class=
"o">=
</span> <span class=
"nx">oData
</span><span class=
"o">;
</span>
782 <span class=
"k">var
</span> <span class=
"nx">options
</span> <span class=
"o">=
</span> <span class=
"nx">oColumn
</span><span class=
"o">.
</span><span class=
"nx">selectOptions
</span><span class=
"o">;
</span>
784 <span class=
"k">var
</span> <span class=
"nx">markup
</span> <span class=
"o">=
</span> <span class=
"s2">"<select
>"</span><span class=
"o">;
</span>
785 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">options
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
786 <span class=
"k">for
</span><span class=
"o">(
</span><span class=
"k">var
</span> <span class=
"nx">i
</span><span class=
"o">=
</span><span class=
"m">0</span><span class=
"o">;
</span> <span class=
"nx">i
</span><span class=
"o"><</span><span class=
"nx">options
</span><span class=
"o">.
</span><span class=
"nx">length
</span><span class=
"o">;
</span> <span class=
"nx">i
</span><span class=
"o">++)
</span> <span class=
"o">{
</span>
787 <span class=
"k">var
</span> <span class=
"nx">option
</span> <span class=
"o">=
</span> <span class=
"nx">options
</span><span class=
"o">[
</span><span class=
"nx">i
</span><span class=
"o">];
</span>
788 <span class=
"nx">markup
</span> <span class=
"o">+=
</span> <span class=
"s2">"<option value=\
""</span> <span class=
"o">+
</span> <span class=
"nx">option
</span> <span class=
"o">+
</span> <span class=
"s2">"\
""</span><span class=
"o">;
</span>
789 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">selectedValue
</span> <span class=
"o">===
</span> <span class=
"nx">option
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
790 <span class=
"nx">markup
</span> <span class=
"o">+=
</span> <span class=
"s2">" selected
"</span><span class=
"o">;
</span>
791 <span class=
"o">}
</span>
792 <span class=
"nx">markup
</span> <span class=
"o">+=
</span> <span class=
"s2">">"</span> <span class=
"o">+
</span> <span class=
"nx">option
</span> <span class=
"o">+
</span> <span class=
"s2">"</option
>"</span><span class=
"o">;
</span>
793 <span class=
"o">}
</span>
794 <span class=
"o">}
</span>
795 <span class=
"k">else
</span> <span class=
"o">{
</span>
796 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">selectedValue
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
797 <span class=
"nx">markup
</span> <span class=
"o">+=
</span> <span class=
"s2">"<option value=\
""</span> <span class=
"o">+
</span> <span class=
"nx">selectedValue
</span> <span class=
"o">+
</span> <span class=
"s2">"\
" selected
>"</span> <span class=
"o">+
</span> <span class=
"nx">selectedValue
</span> <span class=
"o">+
</span> <span class=
"s2">"</option
>"</span><span class=
"o">;
</span>
798 <span class=
"o">}
</span>
799 <span class=
"o">}
</span>
800 <span class=
"nx">markup
</span> <span class=
"o">+=
</span> <span class=
"s2">"</select
>"</span><span class=
"o">;
</span>
801 <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">innerHTML
</span> <span class=
"o">=
</span> <span class=
"nx">markup
</span><span class=
"o">;
</span>
802 <span class=
"o">};
</span>
804 <span class=
"c">/**
</span>
805 <span class=
"c"> * Takes innerHTML from TD and parses out data for storage in RecordSet.
</span>
806 <span class=
"c"> *
</span>
807 <span class=
"c"> * @method parse
</span>
808 <span class=
"c"> * @param sMarkup {String} The TD
's innerHTML value.
</span>
809 <span class=
"c"> * @return {Object} Data.
</span>
810 <span class=
"c"> */
</span>
811 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">parse
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">sMarkup
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
812 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">parser
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
813 <span class=
"k">return
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">parser
</span><span class=
"o">(
</span><span class=
"nx">sMarkup
</span><span class=
"o">);
</span>
814 <span class=
"o">}
</span>
815 <span class=
"k">else
</span> <span class=
"o">{
</span>
816 <span class=
"k">var
</span> <span class=
"nx">data
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
817 <span class=
"nx">switch
</span><span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">type
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
818 <span class=
"nx">case
</span> <span class=
"s2">"checkbox
"</span><span class=
"o">:
</span>
819 <span class=
"nx">data
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">parseCheckbox
</span><span class=
"o">(
</span><span class=
"nx">sMarkup
</span><span class=
"o">);
</span>
820 <span class=
"k">break
</span><span class=
"o">;
</span>
821 <span class=
"nx">case
</span> <span class=
"s2">"currency
"</span><span class=
"o">:
</span>
822 <span class=
"nx">data
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">parseCurrency
</span><span class=
"o">(
</span><span class=
"nx">sMarkup
</span><span class=
"o">);
</span>
823 <span class=
"k">break
</span><span class=
"o">;
</span>
824 <span class=
"nx">case
</span> <span class=
"s2">"date
"</span><span class=
"o">:
</span>
825 <span class=
"nx">data
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">parseDate
</span><span class=
"o">(
</span><span class=
"nx">sMarkup
</span><span class=
"o">);
</span>
826 <span class=
"k">break
</span><span class=
"o">;
</span>
827 <span class=
"nx">case
</span> <span class=
"s2">"number
"</span><span class=
"o">:
</span>
828 <span class=
"nx">data
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">parseNumber
</span><span class=
"o">(
</span><span class=
"nx">sMarkup
</span><span class=
"o">);
</span>
829 <span class=
"k">break
</span><span class=
"o">;
</span>
830 <span class=
"nx">case
</span> <span class=
"s2">"select
"</span><span class=
"o">:
</span>
831 <span class=
"nx">data
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">parseSelect
</span><span class=
"o">(
</span><span class=
"nx">sMarkup
</span><span class=
"o">);
</span>
832 <span class=
"k">break
</span><span class=
"o">;
</span>
833 <span class=
"nx">default
</span><span class=
"o">:
</span>
834 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">sMarkup
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
835 <span class=
"nx">data
</span> <span class=
"o">=
</span> <span class=
"nx">sMarkup
</span><span class=
"o">;
</span>
836 <span class=
"o">}
</span>
837 <span class=
"k">break
</span><span class=
"o">;
</span>
838 <span class=
"o">}
</span>
839 <span class=
"k">return
</span> <span class=
"nx">data
</span><span class=
"o">;
</span>
840 <span class=
"o">}
</span>
841 <span class=
"o">};
</span>
843 <span class=
"c">/**
</span>
844 <span class=
"c"> * Default parse function for Columns of type
"checkbox
" takes markup and
</span>
845 <span class=
"c"> * extracts data. Can be overridden for custom parsing.
</span>
846 <span class=
"c"> *
</span>
847 <span class=
"c"> * @method parseCheckbox
</span>
848 <span class=
"c"> * @param sMarkup
</span>
849 <span class=
"c"> * @return {bChecked} True if checkbox is checked.
</span>
850 <span class=
"c"> */
</span>
851 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">parseCheckbox
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">sMarkup
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
852 <span class=
"k">return
</span> <span class=
"o">(
</span><span class=
"nx">sMarkup
</span><span class=
"o">.
</span><span class=
"nx">indexOf
</span><span class=
"o">(
</span><span class=
"s2">"checked
"</span><span class=
"o">)
</span> <span class=
"o"><</span> <span class=
"m">0</span><span class=
"o">)
</span> <span class=
"o">?
</span> <span class=
"kc">false
</span> <span class=
"o">:
</span> <span class=
"kc">true
</span><span class=
"o">;
</span>
853 <span class=
"o">};
</span>
855 <span class=
"c">/**
</span>
856 <span class=
"c"> * Default parse function for Columns of type
"currency
" takes markup and
</span>
857 <span class=
"c"> * extracts data. Can be overridden for custom parsing.
</span>
858 <span class=
"c"> *
</span>
859 <span class=
"c"> * @method parseCurrency
</span>
860 <span class=
"c"> * @param sMarkup
</span>
861 <span class=
"c"> * @return {nAmount} Floating point amount.
</span>
862 <span class=
"c"> */
</span>
863 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">parseCurrency
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">sMarkup
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
864 <span class=
"k">return
</span> <span class=
"nb">parseFloat
</span><span class=
"o">(
</span><span class=
"nx">sMarkup
</span><span class=
"o">.
</span><span class=
"nx">substring
</span><span class=
"o">(
</span><span class=
"m">1</span><span class=
"o">));
</span>
865 <span class=
"o">};
</span>
867 <span class=
"c">/**
</span>
868 <span class=
"c"> * Default parse function for Columns of type
"date
" takes markup and extracts
</span>
869 <span class=
"c"> * data. Can be overridden for custom parsing.
</span>
870 <span class=
"c"> *
</span>
871 <span class=
"c"> * @method parseDate
</span>
872 <span class=
"c"> * @param sMarkup
</span>
873 <span class=
"c"> * @return {oDate} Date instance.
</span>
874 <span class=
"c"> */
</span>
875 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">parseDate
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">sMarkup
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
876 <span class=
"k">var
</span> <span class=
"nx">mm
</span> <span class=
"o">=
</span> <span class=
"nx">sMarkup
</span><span class=
"o">.
</span><span class=
"nx">substring
</span><span class=
"o">(
</span><span class=
"m">0</span><span class=
"o">,
</span><span class=
"nx">sMarkup
</span><span class=
"o">.
</span><span class=
"nx">indexOf
</span><span class=
"o">(
</span><span class=
"s2">"/
"</span><span class=
"o">));
</span>
877 <span class=
"nx">sMarkup
</span> <span class=
"o">=
</span> <span class=
"nx">sMarkup
</span><span class=
"o">.
</span><span class=
"nx">substring
</span><span class=
"o">(
</span><span class=
"nx">sMarkup
</span><span class=
"o">.
</span><span class=
"nx">indexOf
</span><span class=
"o">(
</span><span class=
"s2">"/
"</span><span class=
"o">)+
</span><span class=
"m">1</span><span class=
"o">);
</span>
878 <span class=
"k">var
</span> <span class=
"nx">dd
</span> <span class=
"o">=
</span> <span class=
"nx">sMarkup
</span><span class=
"o">.
</span><span class=
"nx">substring
</span><span class=
"o">(
</span><span class=
"m">0</span><span class=
"o">,
</span><span class=
"nx">sMarkup
</span><span class=
"o">.
</span><span class=
"nx">indexOf
</span><span class=
"o">(
</span><span class=
"s2">"/
"</span><span class=
"o">));
</span>
879 <span class=
"k">var
</span> <span class=
"nx">yy
</span> <span class=
"o">=
</span> <span class=
"nx">sMarkup
</span><span class=
"o">.
</span><span class=
"nx">substring
</span><span class=
"o">(
</span><span class=
"nx">sMarkup
</span><span class=
"o">.
</span><span class=
"nx">indexOf
</span><span class=
"o">(
</span><span class=
"s2">"/
"</span><span class=
"o">)+
</span><span class=
"m">1</span><span class=
"o">);
</span>
880 <span class=
"k">return
</span> <span class=
"k">new
</span> <span class=
"nb">Date
</span><span class=
"o">(
</span><span class=
"nx">yy
</span><span class=
"o">,
</span> <span class=
"nx">mm
</span><span class=
"o">,
</span> <span class=
"nx">dd
</span><span class=
"o">);
</span>
881 <span class=
"o">};
</span>
883 <span class=
"c">/**
</span>
884 <span class=
"c"> * Default parse function for Columns of type
"number
" takes markup and extracts
</span>
885 <span class=
"c"> * data. Can be overridden for custom parsing.
</span>
886 <span class=
"c"> *
</span>
887 <span class=
"c"> * @method parseNumber
</span>
888 <span class=
"c"> * @param sMarkup
</span>
889 <span class=
"c"> * @return {nNumber} Number.
</span>
890 <span class=
"c"> */
</span>
891 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">parseNumber
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">sMarkup
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
892 <span class=
"k">return
</span> <span class=
"nb">parseFloat
</span><span class=
"o">(
</span><span class=
"nx">sMarkup
</span><span class=
"o">);
</span>
893 <span class=
"o">};
</span>
895 <span class=
"c">/**
</span>
896 <span class=
"c"> * Default parse function for Columns of type
"select
" takes markup and extracts
</span>
897 <span class=
"c"> * data. Can be overridden for custom parsing.
</span>
898 <span class=
"c"> *
</span>
899 <span class=
"c"> * @method parseSelect
</span>
900 <span class=
"c"> * @param sMarkup
</span>
901 <span class=
"c"> * @return {sValue} Value of selected option.
</span>
902 <span class=
"c"> */
</span>
903 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">parseSelect
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">sMarkup
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
904 <span class=
"c">//return (sMarkup.indexOf(
"checked
")
< 0) ? false : true;
</span>
905 <span class=
"c"></span><span class=
"o">};
</span>
907 <span class=
"c">/**
</span>
908 <span class=
"c"> * Outputs editor markup into the given TD based on given Record.
</span>
909 <span class=
"c"> *
</span>
910 <span class=
"c"> * @method showEditor
</span>
911 <span class=
"c"> * @param elCell {HTMLElement} The cell to edit.
</span>
912 <span class=
"c"> * @param oRecord {YAHOO.widget.Record} The DataTable Record of the cell.
</span>
913 <span class=
"c"> * @return YAHOO.widget.ColumnEditor
</span>
914 <span class=
"c"> */
</span>
915 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">Column
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">getEditor
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
916 <span class=
"c">//Sync up the arg signature for ColumnEditor constructor and show()
</span>
917 <span class=
"c"></span> <span class=
"k">var
</span> <span class=
"nx">oEditor
</span> <span class=
"o">=
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">editor
</span><span class=
"o">;
</span>
918 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">oEditor
</span><span class=
"o">.
</span><span class=
"nx">constructor
</span> <span class=
"o">==
</span> <span class=
"nb">String
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
919 <span class=
"nx">oEditor
</span> <span class=
"o">=
</span> <span class=
"k">new
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnEditor
</span><span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">editor
</span><span class=
"o">);
</span>
920 <span class=
"nx">oEditor
</span><span class=
"o">.
</span><span class=
"nx">show
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">,
</span> <span class=
"k">this
</span><span class=
"o">);
</span>
921 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">editor
</span> <span class=
"o">=
</span> <span class=
"nx">oEditor
</span><span class=
"o">;
</span>
922 <span class=
"o">}
</span>
923 <span class=
"k">else
</span> <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">oEditor
</span> <span class=
"k">instanceof
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnEditor
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
924 <span class=
"nx">oEditor
</span><span class=
"o">.
</span><span class=
"nx">show
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">,
</span> <span class=
"k">this
</span><span class=
"o">);
</span>
925 <span class=
"o">}
</span>
926 <span class=
"k">return
</span> <span class=
"nx">oEditor
</span><span class=
"o">;
</span>
927 <span class=
"o">};
</span>
930 <span class=
"c">/****************************************************************************/
</span>
931 <span class=
"c">/****************************************************************************/
</span>
932 <span class=
"c">/****************************************************************************/
</span>
934 <span class=
"c">/**
</span>
935 <span class=
"c"> * The ColumnEditor defines and manages inline editing functionality for a
</span>
936 <span class=
"c"> * DataTable Column.
</span>
937 <span class=
"c"> *
</span>
938 <span class=
"c"> * @class ColumnEditor
</span>
939 <span class=
"c"> * @constructor
</span>
940 <span class=
"c"> * @param elCell {HTMLElement} The cell to edit.
</span>
941 <span class=
"c"> * @param oRecord {YAHOO.widget.Record} The DataTable Record of the cell.
</span>
942 <span class=
"c"> * @param oColumn {YAHOO.widget.Column} The DataTable Column of the cell.
</span>
943 <span class=
"c"> * @parem sType {String} Type identifier
</span>
944 <span class=
"c"> */
</span>
945 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnEditor
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">sType
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
946 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">type
</span> <span class=
"o">=
</span> <span class=
"nx">sType
</span><span class=
"o">;
</span>
948 <span class=
"c">//TODO: make sure ColumnEditors get destroyed if widget gets destroyed
</span>
949 <span class=
"c"></span> <span class=
"c">// Works better to attach ColumnEditor to document.body
</span>
950 <span class=
"c"></span> <span class=
"c">// rather than the DataTable container
</span>
951 <span class=
"c"></span> <span class=
"c">// elTable comes in as a cell. Traverse up DOM to find the table.
</span>
952 <span class=
"c"></span> <span class=
"c">// TODO: safety net in case table is never found.
</span>
953 <span class=
"c"></span> <span class=
"c">//while(elCell.nodeName.toLowerCase() !=
"table
") {
</span>
954 <span class=
"c"></span> <span class=
"c">// elCell = elCell.parentNode;
</span>
955 <span class=
"c"></span> <span class=
"c">//}
</span>
956 <span class=
"c"></span> <span class=
"c">//this.tableContainer = elCell.parentNode;
</span>
957 <span class=
"c"></span>
958 <span class=
"k">var
</span> <span class=
"nx">container
</span> <span class=
"o">=
</span> <span class=
"nb">document
</span><span class=
"o">.
</span><span class=
"nx">body
</span><span class=
"o">.
</span><span class=
"nx">appendChild
</span><span class=
"o">(
</span><span class=
"nb">document
</span><span class=
"o">.
</span><span class=
"nx">createElement
</span><span class=
"o">(
</span><span class=
"s2">"div
"</span><span class=
"o">));
</span><span class=
"c">//this.tableContainer.appendChild(document.createElement(
"div
"));
</span>
959 <span class=
"c"></span> <span class=
"nx">container
</span><span class=
"o">.
</span><span class=
"nx">style
</span><span class=
"o">.
</span><span class=
"nx">position
</span> <span class=
"o">=
</span> <span class=
"s2">"absolute
"</span><span class=
"o">;
</span>
960 <span class=
"nx">container
</span><span class=
"o">.
</span><span class=
"nx">style
</span><span class=
"o">.
</span><span class=
"nx">zIndex
</span> <span class=
"o">=
</span> <span class=
"m">9000</span><span class=
"o">;
</span>
961 <span class=
"nx">container
</span><span class=
"o">.
</span><span class=
"nx">id
</span> <span class=
"o">=
</span> <span class=
"s2">"yui-dt-coled
"</span> <span class=
"o">+
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnEditor
</span><span class=
"o">.
</span><span class=
"nx">_nCount
</span><span class=
"o">;
</span>
962 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">container
</span> <span class=
"o">=
</span> <span class=
"nx">container
</span><span class=
"o">;
</span>
964 <span class=
"nx">switch
</span><span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">type
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
965 <span class=
"nx">case
</span> <span class=
"s2">"textbox
"</span><span class=
"o">:
</span>
966 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">createTextboxEditor
</span><span class=
"o">();
</span>
967 <span class=
"k">break
</span><span class=
"o">;
</span>
968 <span class=
"nx">case
</span> <span class=
"s2">"textarea
"</span><span class=
"o">:
</span>
969 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">createTextareaEditor
</span><span class=
"o">();
</span>
970 <span class=
"k">break
</span><span class=
"o">;
</span>
971 <span class=
"nx">default
</span><span class=
"o">:
</span>
972 <span class=
"k">break
</span><span class=
"o">;
</span>
973 <span class=
"o">}
</span>
975 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnEditor
</span><span class=
"o">.
</span><span class=
"nx">_nCount
</span><span class=
"o">++;
</span>
976 <span class=
"o">};
</span>
980 <span class=
"c">/////////////////////////////////////////////////////////////////////////////
</span>
981 <span class=
"c">//
</span>
982 <span class=
"c">// Private member variables
</span>
983 <span class=
"c">//
</span>
984 <span class=
"c">/////////////////////////////////////////////////////////////////////////////
</span>
985 <span class=
"c"></span>
986 <span class=
"c">/**
</span>
987 <span class=
"c"> * Internal instance counter.
</span>
988 <span class=
"c"> *
</span>
989 <span class=
"c"> * @property _nCount
</span>
990 <span class=
"c"> * @type Number
</span>
991 <span class=
"c"> * @static
</span>
992 <span class=
"c"> * @default
0</span>
993 <span class=
"c"> */
</span>
994 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnEditor
</span><span class=
"o">.
</span><span class=
"nx">_nCount
</span> <span class=
"o">=
</span><span class=
"m">0</span><span class=
"o">;
</span>
996 <span class=
"c">/////////////////////////////////////////////////////////////////////////////
</span>
997 <span class=
"c">//
</span>
998 <span class=
"c">// Public member variables
</span>
999 <span class=
"c">//
</span>
1000 <span class=
"c">/////////////////////////////////////////////////////////////////////////////
</span>
1001 <span class=
"c"></span>
1002 <span class=
"c">/**
</span>
1003 <span class=
"c"> * Reference to the container DOM element for the ColumnEditor.
</span>
1004 <span class=
"c"> *
</span>
1005 <span class=
"c"> * @property container
</span>
1006 <span class=
"c"> * @type HTMLElement
</span>
1007 <span class=
"c"> */
</span>
1008 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnEditor
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">container
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
1010 <span class=
"c">/**
</span>
1011 <span class=
"c"> * Reference to the ColumnEditor
's Column instance.
</span>
1012 <span class=
"c"> *
</span>
1013 <span class=
"c"> * @property column
</span>
1014 <span class=
"c"> * @type YAHOO.widget.Column
</span>
1015 <span class=
"c"> */
</span>
1016 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnEditor
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">column
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
1018 <span class=
"c">/**
</span>
1019 <span class=
"c"> * Type of editor:
"textbox
", etc.
</span>
1020 <span class=
"c"> *
</span>
1021 <span class=
"c"> * @property type
</span>
1022 <span class=
"c"> * @type String
</span>
1023 <span class=
"c"> */
</span>
1024 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnEditor
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">type
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
1028 <span class=
"c">/**
</span>
1029 <span class=
"c"> * Reference to form element(s) of the ColumnEditor.
</span>
1030 <span class=
"c"> *
</span>
1031 <span class=
"c"> * @property input
</span>
1032 <span class=
"c"> * @type HTMLElement || HTMLElement[]
</span>
1033 <span class=
"c"> */
</span>
1034 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnEditor
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">input
</span> <span class=
"o">=
</span> <span class=
"kc">null
</span><span class=
"o">;
</span>
1036 <span class=
"c">/////////////////////////////////////////////////////////////////////////////
</span>
1037 <span class=
"c">//
</span>
1038 <span class=
"c">// Public methods
</span>
1039 <span class=
"c">//
</span>
1040 <span class=
"c">/////////////////////////////////////////////////////////////////////////////
</span>
1041 <span class=
"c"></span>
1042 <span class=
"c">/**
</span>
1043 <span class=
"c"> * Shows ColumnEditor.
</span>
1044 <span class=
"c"> *
</span>
1045 <span class=
"c"> * @method show
</span>
1046 <span class=
"c"> * @param elCell {HTMLElement} The cell to edit.
</span>
1047 <span class=
"c"> * @param oRecord {YAHOO.widget.Record} The DataTable Record of the cell.
</span>
1048 <span class=
"c"> * @param oColumn {YAHOO.widget.Column} The DataTable Column of the cell.
</span>
1049 <span class=
"c"> */
</span>
1050 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnEditor
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">show
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">,
</span> <span class=
"nx">oColumn
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1051 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">cell
</span> <span class=
"o">=
</span> <span class=
"nx">elCell
</span><span class=
"o">;
</span>
1052 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">record
</span> <span class=
"o">=
</span> <span class=
"nx">oRecord
</span><span class=
"o">;
</span>
1053 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">column
</span> <span class=
"o">=
</span> <span class=
"nx">oColumn
</span><span class=
"o">;
</span>
1054 <span class=
"nx">switch
</span><span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">type
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1055 <span class=
"nx">case
</span> <span class=
"s2">"textbox
"</span><span class=
"o">:
</span>
1056 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">showTextboxEditor
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">,
</span> <span class=
"nx">oColumn
</span><span class=
"o">);
</span>
1057 <span class=
"k">break
</span><span class=
"o">;
</span>
1058 <span class=
"nx">case
</span> <span class=
"s2">"textarea
"</span><span class=
"o">:
</span>
1059 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">showTextareaEditor
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">,
</span> <span class=
"nx">oColumn
</span><span class=
"o">);
</span>
1060 <span class=
"k">break
</span><span class=
"o">;
</span>
1061 <span class=
"nx">default
</span><span class=
"o">:
</span>
1062 <span class=
"k">break
</span><span class=
"o">;
</span>
1063 <span class=
"o">}
</span>
1064 <span class=
"o">};
</span>
1066 <span class=
"c">/**
</span>
1067 <span class=
"c"> * Returns ColumnEditor data value.
</span>
1068 <span class=
"c"> *
</span>
1069 <span class=
"c"> * @method getValue
</span>
1070 <span class=
"c"> * @return Object
</span>
1071 <span class=
"c"> */
</span>
1072 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnEditor
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">getValue
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">()
</span> <span class=
"o">{
</span>
1073 <span class=
"k">var
</span> <span class=
"nx">value
</span><span class=
"o">;
</span>
1074 <span class=
"nx">switch
</span><span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">type
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1075 <span class=
"nx">case
</span> <span class=
"s2">"textbox
"</span><span class=
"o">:
</span>
1076 <span class=
"nx">value
</span> <span class=
"o">=
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">getTextboxEditorValue
</span><span class=
"o">();
</span>
1077 <span class=
"k">break
</span><span class=
"o">;
</span>
1078 <span class=
"nx">case
</span> <span class=
"s2">"textarea
"</span><span class=
"o">:
</span>
1079 <span class=
"nx">value
</span> <span class=
"o">=
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">getTextareaEditorValue
</span><span class=
"o">();
</span>
1080 <span class=
"k">break
</span><span class=
"o">;
</span>
1081 <span class=
"nx">default
</span><span class=
"o">:
</span>
1082 <span class=
"k">break
</span><span class=
"o">;
</span>
1083 <span class=
"o">}
</span>
1084 <span class=
"k">return
</span> <span class=
"nx">value
</span><span class=
"o">;
</span>
1085 <span class=
"o">};
</span>
1087 <span class=
"c">/**
</span>
1088 <span class=
"c"> * Creates a textbox editor in the DOM.
</span>
1089 <span class=
"c"> *
</span>
1090 <span class=
"c"> * @method createTextboxEditor
</span>
1091 <span class=
"c"> * @return {HTML} ???
</span>
1092 <span class=
"c"> */
</span>
1093 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnEditor
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">createTextboxEditor
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">()
</span> <span class=
"o">{
</span>
1094 <span class=
"k">var
</span> <span class=
"nx">elTextbox
</span> <span class=
"o">=
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">container
</span><span class=
"o">.
</span><span class=
"nx">appendChild
</span><span class=
"o">(
</span><span class=
"nb">document
</span><span class=
"o">.
</span><span class=
"nx">createElement
</span><span class=
"o">(
</span><span class=
"s2">"input
"</span><span class=
"o">));
</span>
1095 <span class=
"c">// For FF bug
236791</span>
1096 <span class=
"c"></span> <span class=
"nx">elTextbox
</span><span class=
"o">.
</span><span class=
"nx">setAttribute
</span><span class=
"o">(
</span><span class=
"s2">"autocomplete
"</span><span class=
"o">,
</span><span class=
"s2">"off
"</span><span class=
"o">);
</span>
1097 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">input
</span> <span class=
"o">=
</span> <span class=
"nx">elTextbox
</span><span class=
"o">;
</span>
1098 <span class=
"o">};
</span>
1100 <span class=
"c">/**
</span>
1101 <span class=
"c"> * Creates a textarea editor in the DOM.
</span>
1102 <span class=
"c"> *
</span>
1103 <span class=
"c"> * @method createTextareaEditor
</span>
1104 <span class=
"c"> * @return {HTML} ???
</span>
1105 <span class=
"c"> */
</span>
1106 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnEditor
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">createTextareaEditor
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">()
</span> <span class=
"o">{
</span>
1107 <span class=
"k">var
</span> <span class=
"nx">elTextarea
</span> <span class=
"o">=
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">container
</span><span class=
"o">.
</span><span class=
"nx">appendChild
</span><span class=
"o">(
</span><span class=
"nb">document
</span><span class=
"o">.
</span><span class=
"nx">createElement
</span><span class=
"o">(
</span><span class=
"s2">"textarea
"</span><span class=
"o">));
</span>
1108 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">input
</span> <span class=
"o">=
</span> <span class=
"nx">elTextarea
</span><span class=
"o">;
</span>
1109 <span class=
"o">};
</span>
1111 <span class=
"c">/**
</span>
1112 <span class=
"c"> * Shows ColumnEditor
</span>
1113 <span class=
"c"> *
</span>
1114 <span class=
"c"> * @method showTextboxEditor
</span>
1115 <span class=
"c"> * @param elCell {HTMLElement} The cell to edit.
</span>
1116 <span class=
"c"> * @param oRecord {YAHOO.widget.Record} The DataTable Record of the cell.
</span>
1117 <span class=
"c"> * @param oColumn {YAHOO.widget.Column} The DataTable Column of the cell.
</span>
1118 <span class=
"c"> */
</span>
1119 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnEditor
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">showTextboxEditor
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">,
</span> <span class=
"nx">oColumn
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1120 <span class=
"c">// Size and value
</span>
1121 <span class=
"c"></span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">input
</span><span class=
"o">.
</span><span class=
"nx">style
</span><span class=
"o">.
</span><span class=
"nx">width
</span> <span class=
"o">=
</span> <span class=
"o">(
</span><span class=
"nb">parseInt
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">offsetWidth
</span><span class=
"o">,
</span><span class=
"m">10</span><span class=
"o">)-
</span><span class=
"m">7</span><span class=
"o">)
</span> <span class=
"o">+
</span> <span class=
"s2">"px
"</span><span class=
"o">;
</span>
1122 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">input
</span><span class=
"o">.
</span><span class=
"nx">style
</span><span class=
"o">.
</span><span class=
"nx">height
</span> <span class=
"o">=
</span> <span class=
"o">(
</span><span class=
"nb">parseInt
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">offsetHeight
</span><span class=
"o">,
</span><span class=
"m">10</span><span class=
"o">)-
</span><span class=
"m">7</span><span class=
"o">)
</span> <span class=
"o">+
</span> <span class=
"s2">"px
"</span><span class=
"o">;
</span>
1123 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">input
</span><span class=
"o">.
</span><span class=
"nx">value
</span> <span class=
"o">=
</span> <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">innerHTML
</span><span class=
"o">;
</span>
1125 <span class=
"c">// Position and show
</span>
1126 <span class=
"c"></span> <span class=
"k">var
</span> <span class=
"nx">x
</span><span class=
"o">,
</span><span class=
"nx">y
</span><span class=
"o">;
</span>
1128 <span class=
"c">// Don
't use getXY for Opera
</span>
1129 <span class=
"c"></span> <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">navigator
</span><span class=
"o">.
</span><span class=
"nx">userAgent
</span><span class=
"o">.
</span><span class=
"nx">toLowerCase
</span><span class=
"o">().
</span><span class=
"nx">indexOf
</span><span class=
"o">(
</span><span class=
"s2">"opera
"</span><span class=
"o">)
</span> <span class=
"o">!=
</span> <span class=
"o">-
</span><span class=
"m">1</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1130 <span class=
"nx">x
</span> <span class=
"o">=
</span> <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">offsetLeft
</span><span class=
"o">;
</span>
1131 <span class=
"nx">y
</span> <span class=
"o">=
</span> <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">offsetTop
</span><span class=
"o">;
</span>
1132 <span class=
"k">while
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">offsetParent
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1133 <span class=
"nx">x
</span> <span class=
"o">+=
</span> <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">offsetParent
</span><span class=
"o">.
</span><span class=
"nx">offsetLeft
</span><span class=
"o">;
</span>
1134 <span class=
"nx">y
</span> <span class=
"o">+=
</span> <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">offsetParent
</span><span class=
"o">.
</span><span class=
"nx">offsetTop
</span><span class=
"o">;
</span>
1135 <span class=
"nx">elCell
</span> <span class=
"o">=
</span> <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">offsetParent
</span><span class=
"o">;
</span>
1136 <span class=
"o">}
</span>
1137 <span class=
"o">}
</span>
1138 <span class=
"k">else
</span> <span class=
"o">{
</span>
1139 <span class=
"k">var
</span> <span class=
"nx">xy
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Dom
</span><span class=
"o">.
</span><span class=
"nx">getXY
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">);
</span>
1140 <span class=
"nx">x
</span> <span class=
"o">=
</span> <span class=
"nb">parseInt
</span><span class=
"o">(
</span><span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Dom
</span><span class=
"o">.
</span><span class=
"nx">getX
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">),
</span><span class=
"m">10</span><span class=
"o">);
</span><span class=
"c">//xy[
0] +
1;
</span>
1141 <span class=
"c"></span> <span class=
"nx">y
</span> <span class=
"o">=
</span> <span class=
"nb">parseInt
</span><span class=
"o">(
</span><span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Dom
</span><span class=
"o">.
</span><span class=
"nx">getY
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">),
</span><span class=
"m">10</span><span class=
"o">);
</span><span class=
"c">//xy[
1] +
1;
</span>
1142 <span class=
"c"></span> <span class=
"o">}
</span>
1143 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">container
</span><span class=
"o">.
</span><span class=
"nx">style
</span><span class=
"o">.
</span><span class=
"nx">left
</span> <span class=
"o">=
</span> <span class=
"nx">x
</span> <span class=
"o">+
</span> <span class=
"s2">"px
"</span><span class=
"o">;
</span>
1144 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">container
</span><span class=
"o">.
</span><span class=
"nx">style
</span><span class=
"o">.
</span><span class=
"nx">top
</span> <span class=
"o">=
</span> <span class=
"nx">y
</span> <span class=
"o">+
</span> <span class=
"s2">"px
"</span><span class=
"o">;
</span>
1145 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">container
</span><span class=
"o">.
</span><span class=
"nx">style
</span><span class=
"o">.
</span><span class=
"nx">display
</span> <span class=
"o">=
</span> <span class=
"s2">"block
"</span><span class=
"o">;
</span>
1147 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">input
</span><span class=
"o">.
</span><span class=
"nx">tabIndex
</span> <span class=
"o">=
</span> <span class=
"m">0</span><span class=
"o">;
</span>
1148 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">input
</span><span class=
"o">.
</span><span class=
"nx">focus
</span><span class=
"o">();
</span>
1149 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">input
</span><span class=
"o">.
</span><span class=
"nx">select
</span><span class=
"o">();
</span>
1150 <span class=
"o">};
</span>
1152 <span class=
"c">/**
</span>
1153 <span class=
"c"> * Shows ColumnEditor
</span>
1154 <span class=
"c"> *
</span>
1155 <span class=
"c"> * @method showTextareaEditor
</span>
1156 <span class=
"c"> * @param elCell {HTMLElement} The cell to edit.
</span>
1157 <span class=
"c"> * @param oRecord {YAHOO.widget.Record} The DataTable Record of the cell.
</span>
1158 <span class=
"c"> * @param oColumn {YAHOO.widget.Column} The DataTable Column of the cell.
</span>
1159 <span class=
"c"> */
</span>
1160 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnEditor
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">showTextareaEditor
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">,
</span> <span class=
"nx">oRecord
</span><span class=
"o">,
</span> <span class=
"nx">oColumn
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1161 <span class=
"c">// Size and value
</span>
1162 <span class=
"c"></span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">input
</span><span class=
"o">.
</span><span class=
"nx">style
</span><span class=
"o">.
</span><span class=
"nx">width
</span> <span class=
"o">=
</span> <span class=
"o">(
</span><span class=
"nb">parseInt
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">offsetWidth
</span><span class=
"o">,
</span><span class=
"m">10</span><span class=
"o">)-
</span><span class=
"m">7</span><span class=
"o">)
</span> <span class=
"o">+
</span> <span class=
"s2">"px
"</span><span class=
"o">;
</span>
1163 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">input
</span><span class=
"o">.
</span><span class=
"nx">style
</span><span class=
"o">.
</span><span class=
"nx">height
</span> <span class=
"o">=
</span> <span class=
"m">4</span><span class=
"o">*(
</span><span class=
"nb">parseInt
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">offsetHeight
</span><span class=
"o">,
</span><span class=
"m">10</span><span class=
"o">)-
</span><span class=
"m">7</span><span class=
"o">)
</span> <span class=
"o">+
</span> <span class=
"s2">"px
"</span><span class=
"o">;
</span>
1164 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">input
</span><span class=
"o">.
</span><span class=
"nx">value
</span> <span class=
"o">=
</span> <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">innerHTML
</span><span class=
"o">;
</span>
1166 <span class=
"c">// Position and show
</span>
1167 <span class=
"c"></span> <span class=
"k">var
</span> <span class=
"nx">x
</span><span class=
"o">,
</span><span class=
"nx">y
</span><span class=
"o">;
</span>
1169 <span class=
"c">// Don
't use getXY for Opera
</span>
1170 <span class=
"c"></span> <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">navigator
</span><span class=
"o">.
</span><span class=
"nx">userAgent
</span><span class=
"o">.
</span><span class=
"nx">toLowerCase
</span><span class=
"o">().
</span><span class=
"nx">indexOf
</span><span class=
"o">(
</span><span class=
"s2">"opera
"</span><span class=
"o">)
</span> <span class=
"o">!=
</span> <span class=
"o">-
</span><span class=
"m">1</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1171 <span class=
"nx">x
</span> <span class=
"o">=
</span> <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">offsetLeft
</span><span class=
"o">;
</span>
1172 <span class=
"nx">y
</span> <span class=
"o">=
</span> <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">offsetTop
</span><span class=
"o">;
</span>
1173 <span class=
"k">while
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">offsetParent
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1174 <span class=
"nx">x
</span> <span class=
"o">+=
</span> <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">offsetParent
</span><span class=
"o">.
</span><span class=
"nx">offsetLeft
</span><span class=
"o">;
</span>
1175 <span class=
"nx">y
</span> <span class=
"o">+=
</span> <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">offsetParent
</span><span class=
"o">.
</span><span class=
"nx">offsetTop
</span><span class=
"o">;
</span>
1176 <span class=
"nx">elCell
</span> <span class=
"o">=
</span> <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">offsetParent
</span><span class=
"o">;
</span>
1177 <span class=
"o">}
</span>
1178 <span class=
"o">}
</span>
1179 <span class=
"k">else
</span> <span class=
"o">{
</span>
1180 <span class=
"k">var
</span> <span class=
"nx">xy
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Dom
</span><span class=
"o">.
</span><span class=
"nx">getXY
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">);
</span>
1181 <span class=
"nx">x
</span> <span class=
"o">=
</span> <span class=
"nb">parseInt
</span><span class=
"o">(
</span><span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Dom
</span><span class=
"o">.
</span><span class=
"nx">getX
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">),
</span><span class=
"m">10</span><span class=
"o">);
</span><span class=
"c">//xy[
0] +
1;
</span>
1182 <span class=
"c"></span> <span class=
"nx">y
</span> <span class=
"o">=
</span> <span class=
"nb">parseInt
</span><span class=
"o">(
</span><span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Dom
</span><span class=
"o">.
</span><span class=
"nx">getY
</span><span class=
"o">(
</span><span class=
"nx">elCell
</span><span class=
"o">),
</span><span class=
"m">10</span><span class=
"o">);
</span><span class=
"c">//xy[
1] +
1;
</span>
1183 <span class=
"c"></span> <span class=
"o">}
</span>
1184 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">container
</span><span class=
"o">.
</span><span class=
"nx">style
</span><span class=
"o">.
</span><span class=
"nx">left
</span> <span class=
"o">=
</span> <span class=
"nx">x
</span> <span class=
"o">+
</span> <span class=
"s2">"px
"</span><span class=
"o">;
</span>
1185 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">container
</span><span class=
"o">.
</span><span class=
"nx">style
</span><span class=
"o">.
</span><span class=
"nx">top
</span> <span class=
"o">=
</span> <span class=
"nx">y
</span> <span class=
"o">+
</span> <span class=
"s2">"px
"</span><span class=
"o">;
</span>
1186 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">container
</span><span class=
"o">.
</span><span class=
"nx">style
</span><span class=
"o">.
</span><span class=
"nx">display
</span> <span class=
"o">=
</span> <span class=
"s2">"block
"</span><span class=
"o">;
</span>
1188 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">input
</span><span class=
"o">.
</span><span class=
"nx">tabIndex
</span> <span class=
"o">=
</span> <span class=
"m">0</span><span class=
"o">;
</span>
1189 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">input
</span><span class=
"o">.
</span><span class=
"nx">focus
</span><span class=
"o">();
</span>
1190 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">input
</span><span class=
"o">.
</span><span class=
"nx">select
</span><span class=
"o">();
</span>
1191 <span class=
"o">};
</span>
1193 <span class=
"c">/**
</span>
1194 <span class=
"c"> * Hides ColumnEditor
</span>
1195 <span class=
"c"> *
</span>
1196 <span class=
"c"> * @method hide
</span>
1197 <span class=
"c"> */
</span>
1198 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnEditor
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">hide
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">()
</span> <span class=
"o">{
</span>
1199 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">input
</span><span class=
"o">.
</span><span class=
"nx">tabIndex
</span> <span class=
"o">=
</span> <span class=
"o">-
</span><span class=
"m">1</span><span class=
"o">;
</span>
1200 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">container
</span><span class=
"o">.
</span><span class=
"nx">style
</span><span class=
"o">.
</span><span class=
"nx">display
</span> <span class=
"o">=
</span> <span class=
"s2">"none
"</span><span class=
"o">;
</span>
1201 <span class=
"o">};
</span>
1203 <span class=
"c">/**
</span>
1204 <span class=
"c"> * Returns ColumnEditor value
</span>
1205 <span class=
"c"> *
</span>
1206 <span class=
"c"> * @method getTextboxEditorValue
</span>
1207 <span class=
"c"> * @return String
</span>
1208 <span class=
"c"> */
</span>
1209 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnEditor
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">getTextboxEditorValue
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">()
</span> <span class=
"o">{
</span>
1210 <span class=
"k">return
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">input
</span><span class=
"o">.
</span><span class=
"nx">value
</span><span class=
"o">;
</span>
1211 <span class=
"o">};
</span>
1213 <span class=
"c">/**
</span>
1214 <span class=
"c"> * Returns ColumnEditor value
</span>
1215 <span class=
"c"> *
</span>
1216 <span class=
"c"> * @method getTextareaEditorValue
</span>
1217 <span class=
"c"> * @return String
</span>
1218 <span class=
"c"> */
</span>
1219 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">ColumnEditor
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">getTextareaEditorValue
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">()
</span> <span class=
"o">{
</span>
1220 <span class=
"k">return
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">input
</span><span class=
"o">.
</span><span class=
"nx">value
</span><span class=
"o">;
</span>
1221 <span class=
"o">};
</span>
1223 <span class=
"c">/****************************************************************************/
</span>
1224 <span class=
"c">/****************************************************************************/
</span>
1225 <span class=
"c">/****************************************************************************/
</span>
1227 <span class=
"c">/**
</span>
1228 <span class=
"c"> * Sort static utility to support Column sorting.
</span>
1229 <span class=
"c"> *
</span>
1230 <span class=
"c"> * @class Sort
</span>
1231 <span class=
"c"> * @static
</span>
1232 <span class=
"c"> */
</span>
1233 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Sort
</span> <span class=
"o">=
</span> <span class=
"o">{
</span>
1234 <span class=
"c">/////////////////////////////////////////////////////////////////////////////
</span>
1235 <span class=
"c"></span> <span class=
"c">//
</span>
1236 <span class=
"c"></span> <span class=
"c">// Public methods
</span>
1237 <span class=
"c"></span> <span class=
"c">//
</span>
1238 <span class=
"c"></span> <span class=
"c">/////////////////////////////////////////////////////////////////////////////
</span>
1239 <span class=
"c"></span>
1240 <span class=
"c">/**
</span>
1241 <span class=
"c"> * Comparator function for sort in ascending order. String sorting is case insensitive.
</span>
1242 <span class=
"c"> *
</span>
1243 <span class=
"c"> * @method compareAsc
</span>
1244 <span class=
"c"> * @param a {object} First sort argument.
</span>
1245 <span class=
"c"> * @param b {object} Second sort argument.
</span>
1246 <span class=
"c"> */
</span>
1247 <span class=
"nx">compareAsc
</span><span class=
"o">:
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">a
</span><span class=
"o">,
</span> <span class=
"nx">b
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1248 <span class=
"c">//TODO: is typeof better or is constructor property better?
</span>
1249 <span class=
"c"></span> <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">a
</span><span class=
"o">.
</span><span class=
"nx">constructor
</span> <span class=
"o">==
</span> <span class=
"nb">String
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1250 <span class=
"nx">a
</span> <span class=
"o">=
</span> <span class=
"nx">a
</span><span class=
"o">.
</span><span class=
"nx">toLowerCase
</span><span class=
"o">();
</span>
1251 <span class=
"o">}
</span>
1252 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">b
</span><span class=
"o">.
</span><span class=
"nx">constructor
</span> <span class=
"o">==
</span> <span class=
"nb">String
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1253 <span class=
"nx">b
</span> <span class=
"o">=
</span> <span class=
"nx">b
</span><span class=
"o">.
</span><span class=
"nx">toLowerCase
</span><span class=
"o">();
</span>
1254 <span class=
"o">}
</span>
1255 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">a
</span> <span class=
"o"><</span> <span class=
"nx">b
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1256 <span class=
"k">return
</span> <span class=
"o">-
</span><span class=
"m">1</span><span class=
"o">;
</span>
1257 <span class=
"o">}
</span>
1258 <span class=
"k">else
</span> <span class=
"k">if
</span> <span class=
"o">(
</span><span class=
"nx">a
</span> <span class=
"o">></span> <span class=
"nx">b
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1259 <span class=
"k">return
</span> <span class=
"m">1</span><span class=
"o">;
</span>
1260 <span class=
"o">}
</span>
1261 <span class=
"k">else
</span> <span class=
"o">{
</span>
1262 <span class=
"k">return
</span> <span class=
"m">0</span><span class=
"o">;
</span>
1263 <span class=
"o">}
</span>
1264 <span class=
"o">},
</span>
1266 <span class=
"c">/**
</span>
1267 <span class=
"c"> * Comparator function for sort in descending order. String sorting is case insensitive.
</span>
1268 <span class=
"c"> *
</span>
1269 <span class=
"c"> * @method compareDesc
</span>
1270 <span class=
"c"> * @param a {object} First sort argument.
</span>
1271 <span class=
"c"> * @param b {object} Second sort argument.
</span>
1272 <span class=
"c"> */
</span>
1273 <span class=
"nx">compareDesc
</span><span class=
"o">:
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">a
</span><span class=
"o">,
</span> <span class=
"nx">b
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1274 <span class=
"c">//TODO: is typeof better or is constructor property better?
</span>
1275 <span class=
"c"></span> <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">a
</span><span class=
"o">.
</span><span class=
"nx">constructor
</span> <span class=
"o">==
</span> <span class=
"nb">String
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1276 <span class=
"nx">a
</span> <span class=
"o">=
</span> <span class=
"nx">a
</span><span class=
"o">.
</span><span class=
"nx">toLowerCase
</span><span class=
"o">();
</span>
1277 <span class=
"o">}
</span>
1278 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">b
</span><span class=
"o">.
</span><span class=
"nx">constructor
</span> <span class=
"o">==
</span> <span class=
"nb">String
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1279 <span class=
"nx">b
</span> <span class=
"o">=
</span> <span class=
"nx">b
</span><span class=
"o">.
</span><span class=
"nx">toLowerCase
</span><span class=
"o">();
</span>
1280 <span class=
"o">}
</span>
1281 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">a
</span> <span class=
"o"><</span> <span class=
"nx">b
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1282 <span class=
"k">return
</span> <span class=
"m">1</span><span class=
"o">;
</span>
1283 <span class=
"o">}
</span>
1284 <span class=
"k">else
</span> <span class=
"k">if
</span> <span class=
"o">(
</span><span class=
"nx">a
</span> <span class=
"o">></span> <span class=
"nx">b
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1285 <span class=
"k">return
</span> <span class=
"o">-
</span><span class=
"m">1</span><span class=
"o">;
</span>
1286 <span class=
"o">}
</span>
1287 <span class=
"k">else
</span> <span class=
"o">{
</span>
1288 <span class=
"k">return
</span> <span class=
"m">0</span><span class=
"o">;
</span>
1289 <span class=
"o">}
</span>
1290 <span class=
"o">}
</span>
1291 <span class=
"o">};
</span>
1293 <span class=
"c">/****************************************************************************/
</span>
1294 <span class=
"c">/****************************************************************************/
</span>
1295 <span class=
"c">/****************************************************************************/
</span>
1297 <span class=
"c">/**
</span>
1298 <span class=
"c"> * WidthResizer subclasses DragDrop to support resizeable Columns.
</span>
1299 <span class=
"c"> *
</span>
1300 <span class=
"c"> * @class WidthResizer
</span>
1301 <span class=
"c"> * @extends YAHOO.util.DragDrop
</span>
1302 <span class=
"c"> * @constructor
</span>
1303 <span class=
"c"> * @param colElId {string} ID of the Column
's TH element being resized
</span>
1304 <span class=
"c"> * @param handleElId {string} ID of the handle element that causes the resize
</span>
1305 <span class=
"c"> * @param sGroup {string} Group name of related DragDrop items
</span>
1306 <span class=
"c"> */
</span>
1307 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">WidthResizer
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">oDataTable
</span><span class=
"o">,
</span> <span class=
"nx">colId
</span><span class=
"o">,
</span> <span class=
"nx">handleId
</span><span class=
"o">,
</span> <span class=
"nx">sGroup
</span><span class=
"o">,
</span> <span class=
"nx">config
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1308 <span class=
"k">if
</span> <span class=
"o">(
</span><span class=
"nx">colId
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1309 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">cell
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Dom
</span><span class=
"o">.
</span><span class=
"nx">get
</span><span class=
"o">(
</span><span class=
"nx">colId
</span><span class=
"o">);
</span>
1310 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">init
</span><span class=
"o">(
</span><span class=
"nx">handleId
</span><span class=
"o">,
</span> <span class=
"nx">sGroup
</span><span class=
"o">,
</span> <span class=
"nx">config
</span><span class=
"o">);
</span>
1311 <span class=
"c">//this.initFrame();
</span>
1312 <span class=
"c"></span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">datatable
</span> <span class=
"o">=
</span> <span class=
"nx">oDataTable
</span><span class=
"o">;
</span>
1313 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">setYConstraint
</span><span class=
"o">(
</span><span class=
"m">0</span><span class=
"o">,
</span><span class=
"m">0</span><span class=
"o">);
</span>
1314 <span class=
"o">}
</span>
1315 <span class=
"k">else
</span> <span class=
"o">{
</span>
1316 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">log
</span><span class=
"o">(
</span><span class=
"s2">"Column resizer could not be created due to invalid colElId
"</span><span class=
"o">,
</span><span class=
"s2">"warn
"</span><span class=
"o">);
</span>
1317 <span class=
"o">}
</span>
1318 <span class=
"o">};
</span>
1320 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">DD
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1321 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">extend
</span><span class=
"o">(
</span><span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">WidthResizer
</span><span class=
"o">,
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">DD
</span><span class=
"o">);
</span>
1322 <span class=
"o">}
</span>
1324 <span class=
"c">/////////////////////////////////////////////////////////////////////////////
</span>
1325 <span class=
"c">//
</span>
1326 <span class=
"c">// Public DOM event handlers
</span>
1327 <span class=
"c">//
</span>
1328 <span class=
"c">/////////////////////////////////////////////////////////////////////////////
</span>
1329 <span class=
"c"></span>
1330 <span class=
"c">/**
</span>
1331 <span class=
"c"> * Handles mousedown events on the Column resizer.
</span>
1332 <span class=
"c"> *
</span>
1333 <span class=
"c"> * @method onMouseDown
</span>
1334 <span class=
"c"> * @param e {string} The mousedown event
</span>
1335 <span class=
"c"> */
</span>
1336 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">WidthResizer
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">onMouseDown
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">e
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1337 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">startWidth
</span> <span class=
"o">=
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">cell
</span><span class=
"o">.
</span><span class=
"nx">offsetWidth
</span><span class=
"o">;
</span>
1338 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">startPos
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Dom
</span><span class=
"o">.
</span><span class=
"nx">getX
</span><span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">getDragEl
</span><span class=
"o">());
</span>
1340 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">datatable
</span><span class=
"o">.
</span><span class=
"nx">fixedwidth
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1341 <span class=
"k">var
</span> <span class=
"nx">cellText
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Dom
</span><span class=
"o">.
</span><span class=
"nx">getElementsByClassName
</span><span class=
"o">(
</span><span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">DataTable
</span><span class=
"o">.
</span><span class=
"nx">CLASS_COLUMNTEXT
</span><span class=
"o">,
</span><span class=
"s2">"span
"</span><span class=
"o">,
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">cell
</span><span class=
"o">)[
</span><span class=
"m">0</span><span class=
"o">];
</span>
1342 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">minWidth
</span> <span class=
"o">=
</span> <span class=
"nx">cellText
</span><span class=
"o">.
</span><span class=
"nx">offsetWidth
</span> <span class=
"o">+
</span> <span class=
"m">6</span><span class=
"o">;
</span>
1343 <span class=
"k">var
</span> <span class=
"nx">sib
</span> <span class=
"o">=
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">cell
</span><span class=
"o">.
</span><span class=
"nx">nextSibling
</span><span class=
"o">;
</span>
1344 <span class=
"k">var
</span> <span class=
"nx">sibCellText
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Dom
</span><span class=
"o">.
</span><span class=
"nx">getElementsByClassName
</span><span class=
"o">(
</span><span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">widget
</span><span class=
"o">.
</span><span class=
"nx">DataTable
</span><span class=
"o">.
</span><span class=
"nx">CLASS_COLUMNTEXT
</span><span class=
"o">,
</span><span class=
"s2">"span
"</span><span class=
"o">,
</span><span class=
"nx">sib
</span><span class=
"o">)[
</span><span class=
"m">0</span><span class=
"o">];
</span>
1345 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">sibMinWidth
</span> <span class=
"o">=
</span> <span class=
"nx">sibCellText
</span><span class=
"o">.
</span><span class=
"nx">offsetWidth
</span> <span class=
"o">+
</span> <span class=
"m">6</span><span class=
"o">;
</span>
1346 <span class=
"c">//!!
</span>
1347 <span class=
"c"></span> <span class=
"k">var
</span> <span class=
"nx">left
</span> <span class=
"o">=
</span> <span class=
"o">((
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">startWidth
</span> <span class=
"o">-
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">minWidth
</span><span class=
"o">)
</span> <span class=
"o"><</span> <span class=
"m">0</span><span class=
"o">)
</span> <span class=
"o">?
</span> <span class=
"m">0</span> <span class=
"o">:
</span> <span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">startWidth
</span> <span class=
"o">-
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">minWidth
</span><span class=
"o">);
</span>
1348 <span class=
"k">var
</span> <span class=
"nx">right
</span> <span class=
"o">=
</span> <span class=
"o">((
</span><span class=
"nx">sib
</span><span class=
"o">.
</span><span class=
"nx">offsetWidth
</span> <span class=
"o">-
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">sibMinWidth
</span><span class=
"o">)
</span> <span class=
"o"><</span> <span class=
"m">0</span><span class=
"o">)
</span> <span class=
"o">?
</span> <span class=
"m">0</span> <span class=
"o">:
</span> <span class=
"o">(
</span><span class=
"nx">sib
</span><span class=
"o">.
</span><span class=
"nx">offsetWidth
</span> <span class=
"o">-
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">sibMinWidth
</span><span class=
"o">);
</span>
1349 <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">setXConstraint
</span><span class=
"o">(
</span><span class=
"nx">left
</span><span class=
"o">,
</span> <span class=
"nx">right
</span><span class=
"o">);
</span>
1350 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">log
</span><span class=
"o">(
</span><span class=
"s2">"cellstartwidth:
"</span> <span class=
"o">+
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">startWidth
</span><span class=
"o">,
</span><span class=
"s2">"time
"</span><span class=
"o">);
</span>
1351 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">log
</span><span class=
"o">(
</span><span class=
"s2">"cellminwidth:
"</span> <span class=
"o">+
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">minWidth
</span><span class=
"o">,
</span><span class=
"s2">"time
"</span><span class=
"o">);
</span>
1352 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">log
</span><span class=
"o">(
</span><span class=
"s2">"sibstartwidth:
"</span> <span class=
"o">+
</span> <span class=
"nx">sib
</span><span class=
"o">.
</span><span class=
"nx">offsetWidth
</span><span class=
"o">,
</span><span class=
"s2">"time
"</span><span class=
"o">);
</span>
1353 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">log
</span><span class=
"o">(
</span><span class=
"s2">"sibminwidth:
"</span> <span class=
"o">+
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">sibMinWidth
</span><span class=
"o">,
</span><span class=
"s2">"time
"</span><span class=
"o">);
</span>
1354 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">log
</span><span class=
"o">(
</span><span class=
"s2">"l:
"</span> <span class=
"o">+
</span> <span class=
"nx">left
</span> <span class=
"o">+
</span> <span class=
"s2">" AND r:
"</span> <span class=
"o">+
</span> <span class=
"nx">right
</span><span class=
"o">,
</span><span class=
"s2">"time
"</span><span class=
"o">);
</span>
1355 <span class=
"o">}
</span>
1357 <span class=
"o">};
</span>
1359 <span class=
"c">/**
</span>
1360 <span class=
"c"> * Handles mouseup events on the Column resizer.
</span>
1361 <span class=
"c"> *
</span>
1362 <span class=
"c"> * @method onMouseUp
</span>
1363 <span class=
"c"> * @param e {string} The mouseup event
</span>
1364 <span class=
"c"> */
</span>
1365 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">WidthResizer
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">onMouseUp
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">e
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1366 <span class=
"c">//TODO: replace the resizer where it belongs:
</span>
1367 <span class=
"c"></span> <span class=
"k">var
</span> <span class=
"nx">resizeStyle
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Dom
</span><span class=
"o">.
</span><span class=
"nx">get
</span><span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">handleElId
</span><span class=
"o">).
</span><span class=
"nx">style
</span><span class=
"o">;
</span>
1368 <span class=
"nx">resizeStyle
</span><span class=
"o">.
</span><span class=
"nx">left
</span> <span class=
"o">=
</span> <span class=
"s2">"auto
"</span><span class=
"o">;
</span>
1369 <span class=
"nx">resizeStyle
</span><span class=
"o">.
</span><span class=
"nx">right
</span> <span class=
"o">=
</span> <span class=
"m">0</span><span class=
"o">;
</span>
1370 <span class=
"nx">resizeStyle
</span><span class=
"o">.
</span><span class=
"nx">marginRight
</span> <span class=
"o">=
</span> <span class=
"s2">"-
6px
"</span><span class=
"o">;
</span>
1371 <span class=
"nx">resizeStyle
</span><span class=
"o">.
</span><span class=
"nx">width
</span> <span class=
"o">=
</span> <span class=
"s2">"6px
"</span><span class=
"o">;
</span>
1372 <span class=
"c">//.yui-dt-headresizer {position:absolute;margin-right:-
6px;right:
0;bottom:
0;width:
6px;height:
100%;cursor:w-resize;cursor:col-resize;}
</span>
1373 <span class=
"c"></span>
1375 <span class=
"c">//var cells = this.datatable._elTable.tHead.rows[this.datatable._elTable.tHead.rows.length-
1].cells;
</span>
1376 <span class=
"c"></span> <span class=
"c">//for(var i=
0; i
<cells.length; i++) {
</span>
1377 <span class=
"c"></span> <span class=
"c">//cells[i].style.width =
"5px
";
</span>
1378 <span class=
"c"></span> <span class=
"c">//}
</span>
1379 <span class=
"c"></span>
1380 <span class=
"c">//TODO: set new ColumnSet width values
</span>
1381 <span class=
"c"></span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">datatable
</span><span class=
"o">.
</span><span class=
"nx">fireEvent
</span><span class=
"o">(
</span><span class=
"s2">"columnResizeEvent
"</span><span class=
"o">,{
</span><span class=
"nx">datatable
</span><span class=
"o">:
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">datatable
</span><span class=
"o">,
</span><span class=
"nx">target
</span><span class=
"o">:
</span><span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Dom
</span><span class=
"o">.
</span><span class=
"nx">get
</span><span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">id
</span><span class=
"o">)});
</span>
1382 <span class=
"o">};
</span>
1384 <span class=
"c">/**
</span>
1385 <span class=
"c"> * Handles drag events on the Column resizer.
</span>
1386 <span class=
"c"> *
</span>
1387 <span class=
"c"> * @method onDrag
</span>
1388 <span class=
"c"> * @param e {string} The drag event
</span>
1389 <span class=
"c"> */
</span>
1390 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">WidthResizer
</span><span class=
"o">.
</span><span class=
"nx">prototype
</span><span class=
"o">.
</span><span class=
"nx">onDrag
</span> <span class=
"o">=
</span> <span class=
"k">function
</span><span class=
"o">(
</span><span class=
"nx">e
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1391 <span class=
"k">var
</span> <span class=
"nx">newPos
</span> <span class=
"o">=
</span> <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Dom
</span><span class=
"o">.
</span><span class=
"nx">getX
</span><span class=
"o">(
</span><span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">getDragEl
</span><span class=
"o">());
</span><span class=
"c">//YAHOO.log(
"newpos:
"+newPos,
"warn
");//YAHOO.util.Event.getPageX(e);
</span>
1392 <span class=
"c"></span> <span class=
"k">var
</span> <span class=
"nx">offsetX
</span> <span class=
"o">=
</span> <span class=
"nx">newPos
</span> <span class=
"o">-
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">startPos
</span><span class=
"o">;
</span><span class=
"c">//YAHOO.log(
"offset:
"+offsetX,
"warn
");
</span>
1393 <span class=
"c"></span> <span class=
"c">//YAHOO.log(
"startwidth:
"+this.startWidth +
" and offset:
"+offsetX,
"warn
");
</span>
1394 <span class=
"c"></span> <span class=
"k">var
</span> <span class=
"nx">newWidth
</span> <span class=
"o">=
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">startWidth
</span> <span class=
"o">+
</span> <span class=
"nx">offsetX
</span><span class=
"o">;
</span><span class=
"c">//YAHOO.log(
"newwidth:
"+newWidth,
"warn
");
</span>
1395 <span class=
"c"></span>
1396 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">newWidth
</span> <span class=
"o"><</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">minWidth
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1397 <span class=
"nx">newWidth
</span> <span class=
"o">=
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">minWidth
</span><span class=
"o">;
</span>
1398 <span class=
"o">}
</span>
1400 <span class=
"c">// Resize the Column
</span>
1401 <span class=
"c"></span> <span class=
"k">var
</span> <span class=
"nx">oDataTable
</span> <span class=
"o">=
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">datatable
</span><span class=
"o">;
</span>
1402 <span class=
"k">var
</span> <span class=
"nx">elCell
</span> <span class=
"o">=
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">cell
</span><span class=
"o">;
</span>
1404 <span class=
"c">//YAHOO.log(
"newwidth
" + newWidth,
"warn
");
</span>
1405 <span class=
"c"></span> <span class=
"c">//YAHOO.log(newWidth +
" AND
"+ elColumn.offsetWidth +
" AND
" + elColumn.id,
"warn
");
</span>
1406 <span class=
"c"></span>
1407 <span class=
"c">// Resize the other Columns
</span>
1408 <span class=
"c"></span> <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">oDataTable
</span><span class=
"o">.
</span><span class=
"nx">fixedwidth
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1409 <span class=
"c">// Moving right or left?
</span>
1410 <span class=
"c"></span> <span class=
"k">var
</span> <span class=
"nx">sib
</span> <span class=
"o">=
</span> <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">nextSibling
</span><span class=
"o">;
</span>
1411 <span class=
"c">//var sibIndex = elCell.index +
1;
</span>
1412 <span class=
"c"></span> <span class=
"k">var
</span> <span class=
"nx">sibnewwidth
</span> <span class=
"o">=
</span> <span class=
"nx">sib
</span><span class=
"o">.
</span><span class=
"nx">offsetWidth
</span> <span class=
"o">-
</span> <span class=
"nx">offsetX
</span><span class=
"o">;
</span>
1413 <span class=
"k">if
</span><span class=
"o">(
</span><span class=
"nx">sibnewwidth
</span> <span class=
"o"><</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">sibMinWidth
</span><span class=
"o">)
</span> <span class=
"o">{
</span>
1414 <span class=
"nx">sibnewwidth
</span> <span class=
"o">=
</span> <span class=
"k">this
</span><span class=
"o">.
</span><span class=
"nx">sibMinWidth
</span><span class=
"o">;
</span>
1415 <span class=
"o">}
</span>
1417 <span class=
"c">//TODO: how else to cycle through all the Columns without having to use an index property?
</span>
1418 <span class=
"c"></span> <span class=
"k">for
</span><span class=
"o">(
</span><span class=
"k">var
</span> <span class=
"nx">i
</span><span class=
"o">=
</span><span class=
"m">0</span><span class=
"o">;
</span> <span class=
"nx">i
</span><span class=
"o"><</span><span class=
"nx">oDataTable
</span><span class=
"o">.
</span><span class=
"nx">_oColumnSet
</span><span class=
"o">.
</span><span class=
"nx">length
</span><span class=
"o">;
</span> <span class=
"nx">i
</span><span class=
"o">++)
</span> <span class=
"o">{
</span>
1419 <span class=
"k">if
</span><span class=
"o">((
</span><span class=
"nx">i
</span> <span class=
"o">!=
</span> <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">index
</span><span class=
"o">)
</span> <span class=
"o">&&</span> <span class=
"o">(
</span><span class=
"nx">i
</span><span class=
"o">!=
</span><span class=
"nx">sibIndex
</span><span class=
"o">))
</span> <span class=
"o">{
</span>
1420 <span class=
"nx">YAHOO
</span><span class=
"o">.
</span><span class=
"nx">util
</span><span class=
"o">.
</span><span class=
"nx">Dom
</span><span class=
"o">.
</span><span class=
"nx">get
</span><span class=
"o">(
</span><span class=
"nx">oDataTable
</span><span class=
"o">.
</span><span class=
"nx">_oColumnSet
</span><span class=
"o">.
</span><span class=
"nx">keys
</span><span class=
"o">[
</span><span class=
"nx">i
</span><span class=
"o">].
</span><span class=
"nx">id
</span><span class=
"o">).
</span><span class=
"nx">style
</span><span class=
"o">.
</span><span class=
"nx">width
</span> <span class=
"o">=
</span> <span class=
"nx">oDataTable
</span><span class=
"o">.
</span><span class=
"nx">_oColumnSet
</span><span class=
"o">.
</span><span class=
"nx">keys
</span><span class=
"o">[
</span><span class=
"nx">i
</span><span class=
"o">].
</span><span class=
"nx">width
</span> <span class=
"o">+
</span> <span class=
"s2">"px
"</span><span class=
"o">;
</span>
1421 <span class=
"o">}
</span>
1422 <span class=
"o">}
</span>
1423 <span class=
"nx">sib
</span><span class=
"o">.
</span><span class=
"nx">style
</span><span class=
"o">.
</span><span class=
"nx">width
</span> <span class=
"o">=
</span> <span class=
"nx">sibnewwidth
</span><span class=
"o">;
</span>
1424 <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">style
</span><span class=
"o">.
</span><span class=
"nx">width
</span> <span class=
"o">=
</span> <span class=
"nx">newWidth
</span> <span class=
"o">+
</span> <span class=
"s2">"px
"</span><span class=
"o">;
</span>
1425 <span class=
"c">//oDataTable._oColumnSet.flat[sibIndex].width = sibnewwidth;
</span>
1426 <span class=
"c"></span> <span class=
"c">//oDataTable._oColumnSet.flat[elCell.index].width = newWidth;
</span>
1427 <span class=
"c"></span>
1428 <span class=
"o">}
</span>
1429 <span class=
"k">else
</span> <span class=
"o">{
</span>
1430 <span class=
"nx">elCell
</span><span class=
"o">.
</span><span class=
"nx">style
</span><span class=
"o">.
</span><span class=
"nx">width
</span> <span class=
"o">=
</span> <span class=
"nx">newWidth
</span> <span class=
"o">+
</span> <span class=
"s2">"px
"</span><span class=
"o">;
</span>
1431 <span class=
"o">}
</span>
1432 <span class=
"o">};
</span>
1440 <div class=
"module">
1442 <ul class=
"content">
1444 <li class=
""><a href=
"module_animation.html">animation
</a></li>
1446 <li class=
""><a href=
"module_autocomplete.html">autocomplete
</a></li>
1448 <li class=
""><a href=
"module_button.html">button
</a></li>
1450 <li class=
""><a href=
"module_calendar.html">calendar
</a></li>
1452 <li class=
""><a href=
"module_connection.html">connection
</a></li>
1454 <li class=
""><a href=
"module_container.html">container
</a></li>
1456 <li class=
""><a href=
"module_datasource.html">datasource
</a></li>
1458 <li class=
"selected"><a href=
"module_datatable.html">datatable
</a></li>
1460 <li class=
""><a href=
"module_dom.html">dom
</a></li>
1462 <li class=
""><a href=
"module_dragdrop.html">dragdrop
</a></li>
1464 <li class=
""><a href=
"module_element.html">element
</a></li>
1466 <li class=
""><a href=
"module_event.html">event
</a></li>
1468 <li class=
""><a href=
"module_history.html">history
</a></li>
1470 <li class=
""><a href=
"module_logger.html">logger
</a></li>
1472 <li class=
""><a href=
"module_menu.html">menu
</a></li>
1474 <li class=
""><a href=
"module_slider.html">slider
</a></li>
1476 <li class=
""><a href=
"module_tabview.html">tabview
</a></li>
1478 <li class=
""><a href=
"module_treeview.html">treeview
</a></li>
1480 <li class=
""><a href=
"module_yahoo.html">yahoo
</a></li>
1484 <div class=
"module">
1486 <ul class=
"content">
1487 <li class=
""><a href=
"Column.html">Column
</a></li>
1488 <li class=
""><a href=
"ColumnEditor.html">ColumnEditor
</a></li>
1489 <li class=
""><a href=
"ColumnSet.html">ColumnSet
</a></li>
1490 <li class=
""><a href=
"DataTable.html">DataTable
</a></li>
1491 <li class=
""><a href=
"Record.html">Record
</a></li>
1492 <li class=
""><a href=
"RecordSet.html">RecordSet
</a></li>
1493 <li class=
""><a href=
"Sort.html">Sort
</a></li>
1494 <li class=
""><a href=
"WidthResizer.html">WidthResizer
</a></li>
1498 <div class=
"module">
1500 <ul class=
"content">
1501 <li class=
"selected"><a href=
"ColumnSet.js.html">ColumnSet.js
</a></li>
1502 <li class=
""><a href=
"DataTable.js.html">DataTable.js
</a></li>
1503 <li class=
""><a href=
"RecordSet.js.html">RecordSet.js
</a></li>
1516 Copyright
© 2007 Yahoo! Inc. All rights reserved.