datatable-min.js revision 54d173830317b5b4b08bca6b521354692cbc4b83
YUI.add("datatable-base",function(C){var W=C.Lang,G=W.isValue,g=C.Lang.substitute,D=C.Node,T=D.create,P=C.ClassNameManager.getClassName,Q="datatable",R="column",i="focus",l="keydown",H="mouseenter",O="mouseleave",K="mouseup",a="mousedown",d="click",V="dblclick",E=P(Q,"columns"),c=P(Q,"data"),B=P(Q,"msg"),L=P(Q,"liner"),f=P(Q,"first"),I=P(Q,"last"),U=P(Q,"even"),b=P(Q,"odd"),e="<table></table>",X="<col></col>",j='<thead class="'+E+'"></thead>',F='<tbody class="'+c+'"></tbody>',k='<th id="{id}" rowspan="{rowspan}" colspan="{colspan}" class="{classnames}"><div class="'+L+'">{value}</div></th>',h='<tr id="{id}"></tr>',A='<td headers="{headers}" class="{classnames}"><div class="'+L+'">{value}</div></td>',J="{value}",N='<tbody class="'+B+'"></tbody>';function M(Y){M.superclass.constructor.apply(this,arguments);}C.mix(M,{NAME:"column",ATTRS:{id:{valueFn:"_defaultId",writeOnce:true},key:{valueFn:"_defaultKey"},field:{valueFn:"_defaultField"},label:{valueFn:"_defaultLabel"},children:{value:null},abbr:{value:null},classnames:{readOnly:true,getter:"_getClassnames"},formatter:{},sortable:{value:false},editor:{},width:{},resizeable:{},minimized:{},minWidth:{},maxAutoWidth:{}}});C.extend(M,C.Widget,{_defaultId:function(){return C.guid();},_defaultKey:function(Y){return Y||C.guid();},_defaultField:function(Y){return Y||this.get("key");},_defaultLabel:function(Y){return Y||this.get("key");},_afterAbbrChange:function(Y){this._uiSetAbbr(Y.newVal);},keyIndex:null,headers:null,colSpan:1,rowSpan:1,parent:null,initializer:function(Y){},destructor:function(){},_getClassnames:function(){return C.ClassNameManager.getClassName(R,this.get("id"));},syncUI:function(){this._uiSetAbbr(this.get("abbr"));},_uiSetAbbr:function(Y){this._thNode.set("abbr",Y);}});C.Column=M;function Z(Y){Z.superclass.constructor.apply(this,arguments);}C.mix(Z,{NAME:"columnset",ATTRS:{definitions:{setter:"_setDefinitions"}}});C.extend(Z,C.Base,{_setDefinitions:function(Y){return C.clone(Y);},tree:null,hash:null,keys:null,initializer:function(){var Y=[],q={},p=[],o=this.get("definitions"),m=this;function n(y,x,w){var t=0,s=x.length,v,u,r;y++;if(!Y[y]){Y[y]=[];}for(;t<s;++t){v=x[t];v=W.isString(v)?{key:v}:v;u=new C.Column(v);v.yuiColumnId=u.get("id");q[u.get("id")]=u;if(w){u.parent=w;}if(W.isArray(v.children)){r=v.children;u._set("children",r);m._setColSpans(u,v);m._cascadePropertiesToChildren(u,r);if(!Y[y+1]){Y[y+1]=[];}n(y,r,u);}else{u.keyIndex=p.length;p.push(u);}Y[y].push(u);}y--;}n(-1,o);this.tree=Y;this.hash=q;this.keys=p;this._setRowSpans();this._setHeaders();},destructor:function(){},_cascadePropertiesToChildren:function(o,m){var n=0,Y=m.length,p;for(;n<Y;++n){p=m[n];if(o.get("className")&&(p.className===undefined)){p.className=o.get("className");}if(o.get("editor")&&(p.editor===undefined)){p.editor=o.get("editor");}if(o.get("formatter")&&(p.formatter===undefined)){p.formatter=o.get("formatter");}if(o.get("resizeable")&&(p.resizeable===undefined)){p.resizeable=o.get("resizeable");}if(o.get("sortable")&&(p.sortable===undefined)){p.sortable=o.get("sortable");}if(o.get("hidden")){p.hidden=true;}if(o.get("width")&&(p.width===undefined)){p.width=o.get("width");}if(o.get("minWidth")&&(p.minWidth===undefined)){p.minWidth=o.get("minWidth");}if(o.get("maxAutoWidth")&&(p.maxAutoWidth===undefined)){p.maxAutoWidth=o.get("maxAutoWidth");}}},_setColSpans:function(n,m){var o=0;function Y(r){var s=r.children,q=0,p=s.length;for(;q<p;++q){if(W.isArray(s[q].children)){Y(s[q]);}else{o++;}}}Y(m);n.colSpan=o;},_setRowSpans:function(){function Y(o){var q=1,s,r,n,u;function t(x,w){w=w||1;var v=0,m=x.length,p;for(;v<m;++v){p=x[v];if(W.isArray(p.children)){w++;t(p.children,w);w--;}else{if(p.get&&W.isArray(p.get("children"))){w++;t(p.get("children"),w);w--;}else{if(w>q){q=w;}}}}}for(n=0;n<o.length;n++){s=o[n];t(s);for(u=0;u<s.length;u++){r=s[u];if(!W.isArray(r.get("children"))){r.rowSpan=q;}}q=1;}}Y(this.tree);},_setHeaders:function(){var q,o,n=this.keys,m=0,Y=n.length;function p(s,r){s.push(r.get("key"));if(r.parent){p(s,r.parent);}}for(;m<Y;++m){q=[];o=n[m];p(q,o);o.headers=q.reverse().join(" ");}},getColumn:function(){}});C.Columnset=Z;function S(Y){S.superclass.constructor.apply(this,arguments);}C.mix(S,{NAME:"dataTable",ATTRS:{columnset:{setter:"_setColumnset"},recordset:{value:new C.Recordset({records:[]}),setter:"_setRecordset"},summary:{},caption:{},thValueTemplate:{value:J},tdValueTemplate:{value:J},trTemplate:{value:h}},HTML_PARSER:{}});C.extend(S,C.Widget,{thTemplate:k,tdTemplate:A,_theadNode:null,_tbodyNode:null,_msgNode:null,_setColumnset:function(Y){return W.isArray(Y)?new C.Columnset({definitions:Y}):Y;},_afterColumnsetChange:function(Y){if(this.get("rendered")){this._uiSetColumnset(Y.newVal);}},_setRecordset:function(Y){if(W.isArray(Y)){Y=new C.Recordset({records:Y});}Y.addTarget(this);return Y;},_afterRecordsetChange:function(Y){if(this.get("rendered")){this._uiSetRecordset(Y.newVal);}},_afterSummaryChange:function(Y){if(this.get("rendered")){this._uiSetSummary(Y.newVal);}},_afterCaptionChange:function(Y){if(this.get("rendered")){this._uiSetCaption(Y.newVal);}},initializer:function(Y){this.after("columnsetChange",this._afterColumnsetChange);this.after("recordsetChange",this._afterRecordsetChange);this.after("summaryChange",this._afterSummaryChange);this.after("captionChange",this._afterCaptionChange);},destructor:function(){this.get("recordset").removeTarget(this);},renderUI:function(){return(this._addTableNode(this.get("contentBox"))&&this._addColgroupNode(this._tableNode)&&this._addTheadNode(this._tableNode)&&this._addTbodyNode(this._tableNode)&&this._addMessageNode(this._tableNode)&&this._addCaptionNode(this._tableNode));},_addTableNode:function(Y){if(!this._tableNode){this._tableNode=Y.appendChild(T(e));}return this._tableNode;},_addColgroupNode:function(n){var Y=this.get("columnset").keys.length,m=0,o=["<colgroup>"];for(;m<Y;++m){o.push(X);}o.push("</colgroup>");this._colgroupNode=n.insertBefore(T(o.join("")),n.get("firstChild"));return this._colgroupNode;
},_addTheadNode:function(Y){if(Y){this._theadNode=Y.insertBefore(T(j),this._colgroupNode.next());return this._theadNode;}},_addTbodyNode:function(Y){this._tbodyNode=Y.appendChild(T(F));return this._tbodyNode;},_addMessageNode:function(Y){this._msgNode=Y.insertBefore(T(N),this._tbodyNode);return this._msgNode;},_addCaptionNode:function(Y){this._captionNode=Y.createCaption();return this._captionNode;},bindUI:function(){var p=this._tableNode,m=this.get("contentBox"),n="thead."+E+">tr>th",o="tbody."+c+">tr>td",Y="tbody."+B+">tr>td";this.publish("theadCellFocus",{defaultFn:this._defTheadCellFocusFn,emitFacade:false,queuable:true});this.publish("theadRowFocus",{defaultFn:this._defTheadRowFocusFn,emitFacade:false,queuable:true});this.publish("theadFocus",{defaultFn:this._defTheadFocusFn,emitFacade:false,queuable:true});this.publish("tbodyCellFocus",{defaultFn:this._defTbodyCellFocusFn,emitFacade:false,queuable:true});this.publish("tbodyRowFocus",{defaultFn:this._defTbodyRowFocusFn,emitFacade:false,queuable:true});this.publish("tbodyFocus",{defaultFn:this._defTbodyFocusFn,emitFacade:false,queuable:true});this.publish("msgCellFocus",{defaultFn:this._defMsgCellFocusFn,emitFacade:false,queuable:true});this.publish("msgRowFocus",{defaultFn:this._defMsgRowFocusFn,emitFacade:false,queuable:true});this.publish("msgTbodyFocus",{defaultFn:this._defMsgTbodyFocusFn,emitFacade:false,queuable:true});this.publish("theadCellKeydown",{defaultFn:this._defTheadCellKeydownFn,emitFacade:false,queuable:true});this.publish("theadRowKeydown",{defaultFn:this._defTheadRowKeydownFn,emitFacade:false,queuable:true});this.publish("theadKeydown",{defaultFn:this._defTheadKeydownFn,emitFacade:false,queuable:true});this.publish("tbodyCellKeydown",{defaultFn:this._defTbodyCellKeydownFn,emitFacade:false,queuable:true});this.publish("tbodyRowKeydown",{defaultFn:this._defTbodyRowKeydownFn,emitFacade:false,queuable:true});this.publish("tbodyKeydown",{defaultFn:this._defTbodyKeydownFn,emitFacade:false,queuable:true});this.publish("msgCellKeydown",{defaultFn:this._defMsgCellKeydownFn,emitFacade:false,queuable:true});this.publish("msgRowKeydown",{defaultFn:this._defMsgRowKeydownFn,emitFacade:false,queuable:true});this.publish("msgTbodyKeydown",{defaultFn:this._defMsgTbodyKeydownFn,emitFacade:false,queuable:true});this.publish("theadCellMouseenter",{defaultFn:this._defTheadCellMouseenterFn,emitFacade:false,queuable:true});this.publish("theadRowMouseenter",{defaultFn:this._defTheadRowMouseenterFn,emitFacade:false,queuable:true});this.publish("theadMouseenter",{defaultFn:this._defTheadMouseenterFn,emitFacade:false,queuable:true});this.publish("tbodyCellMouseenter",{defaultFn:this._defTbodyCellMouseenterFn,emitFacade:false,queuable:true});this.publish("tbodyRowMouseenter",{defaultFn:this._defTbodyRowMouseenterFn,emitFacade:false,queuable:true});this.publish("tbodyMouseenter",{defaultFn:this._defTbodyMouseenterFn,emitFacade:false,queuable:true});this.publish("msgCellMouseenter",{defaultFn:this._defMsgCellMouseenterFn,emitFacade:false,queuable:true});this.publish("msgRowMouseenter",{defaultFn:this._defMsgRowMouseenterFn,emitFacade:false,queuable:true});this.publish("msgTbodyMouseenter",{defaultFn:this._defMsgTbodyMouseenterFn,emitFacade:false,queuable:true});this.publish("theadCellMouseleave",{defaultFn:this._defTheadCellMouseleaveFn,emitFacade:false,queuable:true});this.publish("theadRowMouseleave",{defaultFn:this._defTheadRowMouseleaveFn,emitFacade:false,queuable:true});this.publish("theadMouseleave",{defaultFn:this._defTheadMouseleaveFn,emitFacade:false,queuable:true});this.publish("tbodyCellMouseleave",{defaultFn:this._defTbodyCellMouseleaveFn,emitFacade:false,queuable:true});this.publish("tbodyRowMouseleave",{defaultFn:this._defTbodyRowMouseleaveFn,emitFacade:false,queuable:true});this.publish("tbodyMouseleave",{defaultFn:this._defTbodyMouseleaveFn,emitFacade:false,queuable:true});this.publish("msgCellMouseleave",{defaultFn:this._defMsgCellMouseleaveFn,emitFacade:false,queuable:true});this.publish("msgRowMouseleave",{defaultFn:this._defMsgRowMouseleaveFn,emitFacade:false,queuable:true});this.publish("msgTbodyMouseleave",{defaultFn:this._defMsgTbodyMouseleaveFn,emitFacade:false,queuable:true});this.publish("theadCellMouseup",{defaultFn:this._defTheadCellMouseupFn,emitFacade:false,queuable:true});this.publish("theadRowMouseup",{defaultFn:this._defTheadRowMouseupFn,emitFacade:false,queuable:true});this.publish("theadMouseup",{defaultFn:this._defTheadMouseupFn,emitFacade:false,queuable:true});this.publish("tbodyCellMouseup",{defaultFn:this._defTbodyCellMouseupFn,emitFacade:false,queuable:true});this.publish("tbodyRowMouseup",{defaultFn:this._defTbodyRowMouseupFn,emitFacade:false,queuable:true});this.publish("tbodyMouseup",{defaultFn:this._defTbodyMouseupFn,emitFacade:false,queuable:true});this.publish("msgCellMouseup",{defaultFn:this._defMsgCellMouseupFn,emitFacade:false,queuable:true});this.publish("msgRowMouseup",{defaultFn:this._defMsgRowMouseupFn,emitFacade:false,queuable:true});this.publish("msgTbodyMouseup",{defaultFn:this._defMsgTbodyMouseupFn,emitFacade:false,queuable:true});this.publish("theadCellMousedown",{defaultFn:this._defTheadCellMousedownFn,emitFacade:false,queuable:true});this.publish("theadRowMousedown",{defaultFn:this._defTheadRowMousedownFn,emitFacade:false,queuable:true});this.publish("theadMousedown",{defaultFn:this._defTheadMousedownFn,emitFacade:false,queuable:true});this.publish("tbodyCellMousedown",{defaultFn:this._defTbodyCellMousedownFn,emitFacade:false,queuable:true});this.publish("tbodyRowMousedown",{defaultFn:this._defTbodyRowMousedownFn,emitFacade:false,queuable:true});this.publish("tbodyMousedown",{defaultFn:this._defTbodyMousedownFn,emitFacade:false,queuable:true});this.publish("msgCellMousedown",{defaultFn:this._defMsgCellMousedownFn,emitFacade:false,queuable:true});this.publish("msgRowMousedown",{defaultFn:this._defMsgRowMousedownFn,emitFacade:false,queuable:true});this.publish("msgTbodyMousedown",{defaultFn:this._defMsgTbodyMousedownFn,emitFacade:false,queuable:true});
this.publish("theadCellClick",{defaultFn:this._defTheadCellClickFn,emitFacade:false,queuable:true});this.publish("theadRowClick",{defaultFn:this._defTheadRowClickFn,emitFacade:false,queuable:true});this.publish("theadClick",{defaultFn:this._defTheadClickFn,emitFacade:false,queuable:true});this.publish("tbodyCellClick",{defaultFn:this._defTbodyCellClickFn,emitFacade:false,queuable:true});this.publish("tbodyRowClick",{defaultFn:this._defTbodyRowClickFn,emitFacade:false,queuable:true});this.publish("tbodyClick",{defaultFn:this._defTbodyClickFn,emitFacade:false,queuable:true});this.publish("msgCellClick",{defaultFn:this._defMsgCellClickFn,emitFacade:false,queuable:true});this.publish("msgRowClick",{defaultFn:this._defMsgRowClickFn,emitFacade:false,queuable:true});this.publish("msgTbodyClick",{defaultFn:this._defMsgTbodyClickFn,emitFacade:false,queuable:true});this.publish("theadCellDblclick",{defaultFn:this._defTheadCellDblclickFn,emitFacade:false,queuable:true});this.publish("theadRowDblclick",{defaultFn:this._defTheadRowDblclickFn,emitFacade:false,queuable:true});this.publish("theadDblclick",{defaultFn:this._defTheadDblclickFn,emitFacade:false,queuable:true});this.publish("tbodyCellDblclick",{defaultFn:this._defTbodyCellDblclickFn,emitFacade:false,queuable:true});this.publish("tbodyRowDblclick",{defaultFn:this._defTbodyRowDblclickFn,emitFacade:false,queuable:true});this.publish("tbodyDblclick",{defaultFn:this._defTbodyDblclickFn,emitFacade:false,queuable:true});this.publish("msgCellDblclick",{defaultFn:this._defMsgCellDblclickFn,emitFacade:false,queuable:true});this.publish("msgRowDblclick",{defaultFn:this._defMsgRowDblclickFn,emitFacade:false,queuable:true});this.publish("msgTbodyDblclick",{defaultFn:this._defMsgTbodyDblclickFn,emitFacade:false,queuable:true});p.delegate(i,this._onDomEvent,n,this,"theadCellFocus");p.delegate(l,this._onDomEvent,n,this,"theadCellKeydown");p.delegate(H,this._onDomEvent,n,this,"theadCellMouseenter");p.delegate(O,this._onDomEvent,n,this,"theadCellMouseleave");p.delegate(K,this._onDomEvent,n,this,"theadCellMouseup");p.delegate(a,this._onDomEvent,n,this,"theadCellMousedown");p.delegate(d,this._onDomEvent,n,this,"theadCellClick");m.delegate(V,this._onDomEvent,n,this,"theadCellDblclick");p.delegate(i,this._onDomEvent,o,this,"tbodyCellFocus");p.delegate(l,this._onDomEvent,o,this,"tbodyCellKeydown");p.delegate(H,this._onDomEvent,o,this,"tbodyCellMouseenter");p.delegate(O,this._onDomEvent,o,this,"tbodyCellMouseleave");p.delegate(K,this._onDomEvent,o,this,"tbodyCellMouseup");p.delegate(a,this._onDomEvent,o,this,"tbodyCellMousedown");p.delegate(d,this._onDomEvent,o,this,"tbodyCellClick");m.delegate(V,this._onDomEvent,o,this,"tbodyCellDblclick");p.delegate(i,this._onDomEvent,Y,this,"msgCellFocus");p.delegate(l,this._onDomEvent,Y,this,"msgCellKeydown");p.delegate(H,this._onDomEvent,Y,this,"msgCellMouseenter");p.delegate(O,this._onDomEvent,Y,this,"msgCellMouseleave");p.delegate(K,this._onDomEvent,Y,this,"msgCellMouseup");p.delegate(a,this._onDomEvent,Y,this,"msgCellMousedown");p.delegate(d,this._onDomEvent,Y,this,"msgCellClick");m.delegate(V,this._onDomEvent,Y,this,"msgCellDblclick");},_onDomEvent:function(m,Y){this.fire(Y,m);},_defTheadCellClickFn:function(Y){this.fire("theadRowClick",Y);},_defTheadRowClickFn:function(Y){this.fire("theadClick",Y);},_defTheadClickFn:function(Y){},syncUI:function(){this._uiSetColumnset(this.get("columnset"));this._uiSetRecordset(this.get("recordset"));this._uiSetSummary(this.get("summary"));this._uiSetCaption(this.get("caption"));},_uiSetSummary:function(Y){Y=G(Y)?Y:"";this._tableNode.set("summary",Y);},_uiSetCaption:function(Y){Y=G(Y)?Y:"";this._captionNode.setContent(Y);},_uiSetColumnset:function(p){var m=p.tree,r=this._theadNode,n=0,Y=m.length,o=r.get("parentNode"),q=r.next();r.remove();r.get("children").remove(true);for(;n<Y;++n){this._addTheadTrNode({thead:r,columns:m[n]},(n===0),(n===Y-1));}o.insert(r,q);},_addTheadTrNode:function(n,Y,m){n.tr=this._createTheadTrNode(n,Y,m);this._attachTheadTrNode(n);},_createTheadTrNode:function(t,m,s){var r=T(g(this.get("trTemplate"),t)),p=0,n=t.columns,Y=n.length,q;if(m){r.addClass(f);}if(s){r.addClass(I);}for(;p<Y;++p){q=n[p];this._addTheadThNode({value:q.get("label"),column:q,tr:r});}return r;},_attachTheadTrNode:function(Y){Y.thead.appendChild(Y.tr);},_addTheadThNode:function(Y){Y.th=this._createTheadThNode(Y);this._attachTheadThNode(Y);},_createTheadThNode:function(m){var Y=m.column;m.id=Y.get("id");m.colspan=Y.colSpan;m.rowspan=Y.rowSpan;m.classnames=Y.get("classnames");m.value=g(this.get("thValueTemplate"),m);return T(g(this.thTemplate,m));},_attachTheadThNode:function(Y){Y.tr.appendChild(Y.th);},_uiSetRecordset:function(m){var p=0,Y=m.getLength(),n=this._tbodyNode,q=n.get("parentNode"),r=n.next(),s={tbody:n};n.remove();for(;p<Y;++p){s.record=m.getRecord(p);s.rowindex=p;this._addTbodyTrNode(s);}q.insert(n,r);},_addTbodyTrNode:function(n){var m=n.tbody,Y=n.record;n.tr=m.one("#"+Y.get("id"))||this._createTbodyTrNode(n);this._attachTbodyTrNode(n);},_createTbodyTrNode:function(q){var p=T(g(this.get("trTemplate"),{id:q.record.get("id")})),m=0,n=this.get("columnset").keys,Y=n.length;q.tr=p;for(;m<Y;++m){q.column=n[m];this._addTbodyTdNode(q);}return p;},_attachTbodyTrNode:function(q){var m=q.tbody,p=q.tr,Y=q.rowindex,n=m.get("children").item(Y)||null,r=(Y%2===0);if(r){p.replaceClass(b,U);}else{p.replaceClass(U,b);}m.insertBefore(p,n);},_addTbodyTdNode:function(Y){Y.td=this._createTbodyTdNode(Y);this._attachTbodyTdNode(Y);},_createTbodyTdNode:function(m){var Y=m.column;m.headers=Y.get("headers");m.classnames=Y.get("classnames");m.value=this.formatDataCell(m);return T(g(this.tdTemplate,m));},_attachTbodyTdNode:function(Y){Y.tr.appendChild(Y.td);},formatDataCell:function(m){var Y=m.record;m.data=Y.get("data");m.value=Y.getValue(m.column.get("field"));return g(this.get("tdValueTemplate"),m);}});C.namespace("DataTable").Base=S;},"@VERSION@",{requires:["substitute","widget","recordset-base"]});YUI.add("datatable-datasource",function(B){function A(){A.superclass.constructor.apply(this,arguments);
}B.mix(A,{NS:"datasource",NAME:"dataTableDataSource",ATTRS:{datasource:{setter:"_setDataSource"},initialRequest:{setter:"_setInitialRequest"}}});B.extend(A,B.Plugin.Base,{_setDataSource:function(C){return C||new B.DataSource.Local(C);},_setInitialRequest:function(C){},initializer:function(C){if(!B.Lang.isUndefined(C.initialRequest)){this.load({request:C.initialRequest});}},load:function(C){C=C||{};C.request=C.request||this.get("initialRequest");C.callback=C.callback||{success:B.bind(this.onDataReturnInitializeTable,this),failure:B.bind(this.onDataReturnInitializeTable,this),argument:this.get("host").get("state")};var D=(C.datasource||this.get("datasource"));if(D){D.sendRequest(C);}},onDataReturnInitializeTable:function(C){this.get("host").set("recordset",new B.Recordset({records:C.response.results}));}});B.namespace("Plugin").DataTableDataSource=A;},"@VERSION@",{requires:["plugin","datatable-base","datasource-local"]});YUI.add("datatable-sort",function(A){var H=A.ClassNameManager.getClassName,I="datatable",B="asc",D="desc",C=H(I,"asc"),E=H(I,"desc"),F=H(I,"sortable"),J='<a class="{link_class}" title="{link_title}" href="{link_href}">{value}</a>';function G(){G.superclass.constructor.apply(this,arguments);}A.mix(G,{NS:"sort",NAME:"dataTableSort",ATTRS:{trigger:{value:"theadCellClick",writeOnce:"initOnly"},lastSortedBy:{value:null},template:{value:J}}});A.extend(G,A.Plugin.Base,{initializer:function(K){var L=this.get("host");L.get("recordset").plug(A.Plugin.RecordsetSort,{dt:L});L.get("recordset").sort.addTarget(L);this.doBefore("_createTheadThNode",this._beforeCreateTheadThNode);this.doBefore("_attachTheadThNode",function(M){if(M.column.get("sortable")){M.th.addClass(F);}});L.on(this.get("trigger"),A.bind(this._onEventSortColumn,this));L.after("recordsetSort:sort",function(){L._uiSetRecordset(L.get("recordset"));});L.after("lastSortedByChangeEvent",function(){});if(L.get("rendered")){L._uiSetColumnset(L.get("columnset"));}},_beforeCreateTheadThNode:function(K){if(K.column.get("sortable")){K.value=A.substitute(this.get("template"),{link_class:"foo",link_title:"bar",link_href:"bat",value:K.value});}},_onEventSortColumn:function(O){O.halt();var M=this.get("host"),L=M.get("columnset").hash[O.currentTarget.get("id")],N=L.get("field"),P=this.get("lastSortedBy"),K=(P&&P.field===N&&P.dir===B)?D:B,Q=L.get("sortFn");if(L.get("sortable")){M.get("recordset").sort.sort(N,K===D,Q);this.set("lastSortedBy",{field:N,dir:K});}}});A.namespace("Plugin").DataTableSort=G;},"@VERSION@",{requires:["plugin","datatable-base","recordset-sort"],lang:["en"]});YUI.add("datatable-scroll",function(B){var L=B.Do,M=B.Node,J=B.Lang,O=B.UA,C=B.StyleSheet,F=B.ClassNameManager.getClassName,N="datatable",A=F(N,"hd"),E=F(N,"bd"),K=F(N,"liner"),I=F(N,"scrollable"),H='<div class="'+A+'"></div>',D='<div class="'+E+'"></div>',G="<table></table>";function P(){P.superclass.constructor.apply(this,arguments);}B.mix(P,{NS:"scroll",NAME:"dataTableScroll",ATTRS:{width:{value:undefined},height:{value:undefined},scroll:{value:"y"},COLOR_COLUMNFILLER:{value:"#f2f2f2",validator:J.isString,setter:function(Q){if(this._headerContainerNode){this._headerContainerNode.setStyle("backgroundColor",Q);}}}}});B.extend(P,B.Plugin.Base,{_parentTableNode:null,_parentTheadNode:null,_parentTbodyNode:null,_parentMsgNode:null,_parentContainer:null,_bodyContainerNode:null,_headerContainerNode:null,initializer:function(Q){var R=this.get("host");this._parentContainer=R.get("contentBox");this._parentContainer.addClass(I);this._setUpNodes();},_setUpNodes:function(){var Q=this.get("host");this.afterHostMethod("_addTableNode",this._setUpParentTableNode);this.afterHostMethod("_addTheadNode",this._setUpParentTheadNode);this.afterHostMethod("_addTbodyNode",this._setUpParentTbodyNode);this.afterHostMethod("_addMessageNode",this._setUpParentMessageNode);this.beforeHostMethod("renderUI",this._removeCaptionNode);this.afterHostMethod("renderUI",this.renderUI);this.afterHostMethod("syncUI",this.syncUI);if(this.get("scroll")!=="x"){this.afterHostMethod("_attachTheadThNode",this._attachTheadThNode);this.afterHostMethod("_attachTbodyTdNode",this._attachTbodyTdNode);}},_setUpParentTableNode:function(){this._parentTableNode=this.get("host")._tableNode;},_setUpParentTheadNode:function(){this._parentTheadNode=this.get("host")._theadNode;},_setUpParentTbodyNode:function(){this._parentTbodyNode=this.get("host")._tbodyNode;},_setUpParentMessageNode:function(){this._parentMsgNode=this.get("host")._msgNode;},renderUI:function(){this._createBodyContainer();this._createHeaderContainer();this._setContentBoxDimensions();},syncUI:function(){this._syncWidths();this._syncScroll();},_removeCaptionNode:function(){B.DataTable.Base.prototype.createCaption=function(Q){};B.DataTable.Base.prototype._uiSetCaption=function(Q){};},_syncWidths:function(){var R=M.all("#"+this._parentContainer.get("id")+" .yui3-datatable-hd table thead th"),S=M.one("#"+this._parentContainer.get("id")+" .yui3-datatable-bd table .yui3-datatable-data").get("firstChild").get("children"),T,W,Y,V,X,U,Q=O.ie;for(T=0,W=R.size();T<W;T++){X=R.item(T).get("firstChild");U=S.item(T).get("firstChild");if(!Q){Y=X.get("clientWidth");V=S.item(T).get("clientWidth");}else{Y=X.get("offsetWidth");V=S.item(T).get("offsetWidth");}if(Y>V){U.setStyle("width",(Y-20+"px"));}else{if(V>Y){X.setStyle("width",(V-20+"px"));}}}if(Q&&this.get("scroll")==="y"&&this._bodyContainerNode.get("scrollHeight")>this._bodyContainerNode.get("offsetHeight")){this._headerContainerNode.setStyle("width",this._parentContainer.get("offsetWidth")+15+"px");}},_attachTheadThNode:function(R){var Q=R.column.get("width")||"auto";if(Q!=="auto"){R.th.get("firstChild").setStyles({"width":Q,"overflow":"hidden"});}return R;},_attachTbodyTdNode:function(R){var Q=R.column.get("width")||"auto";if(Q!=="auto"){R.td.get("firstChild").setStyles({"width":Q,"overflow":"hidden"});}return R;},_createBodyContainer:function(){var R=M.create(D),Q=B.bind("_onScroll",this);this._bodyContainerNode=R;this._setStylesForTbody();
R.appendChild(this._parentTableNode);this._parentContainer.appendChild(R);R.on("scroll",Q);},_createHeaderContainer:function(){var R=M.create(H),Q=M.create(G);this._headerContainerNode=R;this._setStylesForThead();Q.appendChild(this._parentTheadNode);R.appendChild(Q);this._parentContainer.prepend(R);},_setStylesForTbody:function(){var R=this.get("scroll"),Q=this.get("width")||"",T=this.get("height")||"",S=this._bodyContainerNode,U={"width":"","height":T};if(R==="x"){U["overflowY"]="hidden";U["width"]=Q;}else{if(R==="y"){U["overflowX"]="hidden";}else{U["width"]=Q;}}S.setStyles(U);return S;},_setStylesForThead:function(){var R=this.get("scroll"),Q=this.get("width")||"",S=this._headerContainerNode;S.setStyles({"width":Q,"overflow":"hidden"});},_setContentBoxDimensions:function(){if(this.get("scroll")==="y"||(!this.get("width"))){this._parentContainer.setStyle("width","auto");}},_onScroll:function(){this._headerContainerNode.set("scrollLeft",this._bodyContainerNode.get("scrollLeft"));},_syncScroll:function(){this._syncScrollX();this._syncScrollY();this._syncScrollOverhang();if(O.opera){this._headerContainerNode.set("scrollLeft",this._bodyContainerNode.get("scrollLeft"));if(!this.get("width")){document.body.style+="";}}},_syncScrollY:function(){var Q=this._parentTbodyNode,S=this._bodyContainerNode,R;if(!this.get("width")){R=(S.get("scrollHeight")>S.get("clientHeight"))?(Q.get("parentNode").get("clientWidth")+19)+"px":(Q.get("parentNode").get("clientWidth")+2)+"px";this._parentContainer.setStyle("width",R);}},_syncScrollX:function(){var Q=this._parentTbodyNode,S=this._bodyContainerNode,R;this._headerContainerNode.set("scrollLeft",this._bodyContainerNode.get("scrollLeft"));if(!this.get("height")&&(O.ie)){R=(S.get("scrollWidth")>S.get("offsetWidth"))?(Q.get("parentNode").get("offsetHeight")+18)+"px":Q.get("parentNode").get("offsetHeight")+"px";S.setStyle("height",R);}if(Q.get("rows").length===0){this._parentMsgNode.get("parentNode").setStyle("width",this._parentTheadNode.get("parentNode").get("offsetWidth")+"px");}else{this._parentMsgNode.get("parentNode").setStyle("width","");}},_syncScrollOverhang:function(){var Q=this._bodyContainerNode,R=1;if((Q.get("scrollHeight")>Q.get("clientHeight"))||(Q.get("scrollWidth")>Q.get("clientWidth"))){R=18;}this._setOverhangValue(R);},_setOverhangValue:function(R){var T=this.get("host"),V=T.get("columnset").get("definitions"),Q=V.length,U=R+"px solid "+this.get("COLOR_COLUMNFILLER"),S=M.all("#"+this._parentContainer.get("id")+" ."+A+" table thead th");S.item(Q-1).setStyle("borderRight",U);}});B.namespace("Plugin").DataTableScroll=P;},"@VERSION@",{requires:["plugin","datatable-base","stylesheet"]});YUI.add("datatable",function(A){},"@VERSION@",{use:["datatable-base","datatable-datasource","datatable-sort","datatable-scroll"]});