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 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 z=b.$n();try{b.unbind();if(b.hasGroup())for(var f=b.getGroups(),d=f.length;0<=--d;)b.removeChild(f[d]);f=[];for(var A=this.getChildIndex(),r=d=0,B=n.getBodyWidgetIterator(),t;t=B.next();r++)for(var h=0,e=t.firstChild;e;e=e.nextSibling,
h++)h==A&&(f[d++]={wgt:e,index:r});var C="ascending"==l?-1:1,u=this.sorting,v="client(number)"==m;for(f.sort(function(w,x){var p=u(w.wgt,x.wgt,v)*C;0==p&&(p=w.index<x.index?-1:1);return p});b.firstChild;)b.removeChild(b.firstChild);var D=this.getChildIndex();d=0;for(h=f.length;d<h;d++){var k=f[d];if(!y||0!=u(y.wgt,k.wgt,v)){if((e=k.wgt.parent.getChildAt(D))&&e.$instanceof(zul.wgt.Label)){var g=new zkex.grid.Group;g.appendChild(new zul.wgt.Label({value:e.getValue()}))}else{var q=e.firstChild;q&&q.$instanceof(zul.wgt.Label)?
(g=new zkex.grid.Group,g.appendChild(new zul.wgt.Label({value:q.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 y=k}this._fixDirection(a)}finally{b.replaceHTML(z,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"))}});
