zul.grid.Column=zk.$extends(zul.mesh.SortWidget,{getGrid:function(){return this.parent?this.parent.parent:null},$init:function(){this.$supers("$init",arguments);this.listen({onGroup:this},-1E3)},getMeshBody:function(){var a=this.getGrid();return a?a.rows:null},checkClientSort_:function(a){var c;return!(!(c=this.getMeshBody())||c.hasGroup())&&this.$supers("checkClientSort_",arguments)},group:function(a,c){var d,l=this.getSortDirection();if(a){if("ascending"==l)return!1}else if("descending"==l)return!1;
var m=a?this._sortAscending:this._sortDescending;if("fromServer"==m)return!1;if("none"==m)return c.stop(),!1;var n=this.getMeshWidget();if(!n||n.isModel()||!zk.feature.pe||!zk.isLoaded("zkex.grid"))return!1;var b=this.getMeshBody();if(!b)return!1;c.stop();c=b.desktop;var w=b.$n();try{b.unbind();if(b.hasGroup())for(var f=b.getGroups(),e=f.length;0<=--e;)b.removeChild(f[e]);f=[];for(var x=this.getChildIndex(),q=e=0,y=n.getBodyWidgetIterator(),r;r=y.next();q++){var h=0;for(d=r.firstChild;d;d=d.nextSibling,
h++)h==x&&(f[e++]={wgt:d,index:q})}var z="ascending"==l?-1:1,t=this.sorting,u="client(number)"==m;for(f.sort(function(a,b){var c=t(a.wgt,b.wgt,u)*z;0==c&&(c=a.index<b.index?-1:1);return c});b.firstChild;)b.removeChild(b.firstChild);var A=this.getChildIndex();e=0;for(h=f.length;e<h;e++){var k=f[e];if(!v||0!=t(v.wgt,k.wgt,u)){if((d=k.wgt.parent.getChildAt(A))&&d.$instanceof(zul.wgt.Label)){var g=new zkex.grid.Group;g.appendChild(new zul.wgt.Label({value:d.getValue()}))}else{var p=d.firstChild;p&&p.$instanceof(zul.wgt.Label)?
(g=new zkex.grid.Group,g.appendChild(new zul.wgt.Label({value:p.getValue()}))):(g=new zkex.grid.Group,g.appendChild(new zul.wgt.Label({value:msgzul.GRID_OTHER})))}b.appendChild(g)}b.appendChild(k.wgt.parent);var v=k}this._fixDirection(a)}finally{b.replaceHTML(w,c)}return!0},setLabel:function(a){this.$supers("setLabel",arguments);this.parent&&this.parent._syncColMenu()},setVisible:function(a){this.isVisible()!=a&&(this.$supers("setVisible",arguments),this.parent&&this.parent._syncColMenu())},onGroup:function(a){var c=
this.getSortDirection();"ascending"==c?this.group(!1,a):"descending"==c?this.group(!0,a):this.group(!0,a)||this.group(!1,a)},bind_:function(){this.$supers(zul.grid.Column,"bind_",arguments);var a=this.$n();this.domListen_(a,"onMouseOver").domListen_(a,"onMouseOut");(a=this.$n("btn"))&&this.domListen_(a,"onClick","_doMenuClick")},unbind_:function(){var a=this.$n();this.domUnlisten_(a,"onMouseOver").domUnlisten_(a,"onMouseOut");(a=this.$n("btn"))&&this.domUnlisten_(a,"onClick","_doMenuClick");this.$supers(zul.grid.Column,
"unbind_",arguments)},_doMouseOver:function(a){(this.isSortable_()||this.parent._menupopup&&"none"!=this.parent._menupopup)&&jq(this.$n()).addClass(this.$s("hover"))},_doMouseOut:function(a){if(this.isSortable_()||this.parent._menupopup&&"none"!=this.parent._menupopup)a=jq(this.$n()),a.hasClass(this.$s("visited"))||a.removeClass(this.$s("hover"))}});
