datatable-sort-min.js revision beae2c1bcdd24bf81c3ce3774966c9928b4a4637
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"},sortedBy:{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"),this._onEventSortColumn);L.after("recordsetSort:sort",function(){L._uiSetRecordset(L.get("recordset"));});L.after("sortedByChangeEvent",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("columnset").get("hash")[O.currentTarget.get("id")],N=M.get("field"),L=this.get("sortedBy"),K=(L&&L.field===N&&L.dir===B)?D:B,P=M.get("sortFn");if(M.get("sortable")){this.get("recordset").sort.sort(N,K===D,P);this.set("sortedBy",{field:N,dir:K});}}});A.namespace("Plugin").DataTableSort=G;},"@VERSION@",{requires:["plugin","datatable-base","recordset-sort"],lang:["en"]});