/* * Kendo UI Web v2012.2.710 (http://kendoui.com) * Copyright 2012 Telerik AD. All rights reserved. * * Kendo UI Web commercial licenses may be obtained at http://kendoui.com/web-license * If you do not own a commercial license, this file shall be governed by the * GNU General Public License (GPL) version 3. * For GPL requirements, please review: http://www.gnu.org/copyleft/gpl.html */ ;(function(a,b){function s(a){String.prototype.trim?a=a.trim():a=a.replace(/^\s\s*/,"").replace(/\s\s*$/,"");return a.replace(/ /gi,"")}var c=window.kendo,d=c.ui,e=a.proxy,f=a.extend,g=a.grep,h=a.map,i=a.inArray,j="k-state-selected",k="asc",l="desc",m="click",n="change",o="kendoPopup",p="kendoFilterMenu",q="kendoMenu",r=d.Widget,t=r.extend({init:function(b,d){var f=this,g;r.fn.init.call(f,b,d),b=f.element,d=f.options,f.owner=d.owner,f.field=b.attr(c.attr("field")),g=b.find(".k-header-column-menu"),g[0]||(g=b.prepend('').find(".k-header-column-menu")),f._clickHandler=e(f._click,f),g.click(f._clickHandler),f.link=g,f.wrapper=a('
'),f.wrapper.html(c.template(u)({ns:c.ns,messages:d.messages,sortable:d.sortable,filterable:d.filterable,columns:f._ownerColumns(),showColumns:d.columns})),f.popup=f.wrapper[o]({anchor:g,open:e(f._open,f)}).data(o),f._menu(),f._sort(),f._columns(),f._filter()},options:{name:"ColumnMenu",messages:{sortAscending:"Sort Ascending",sortDescending:"Sort Descending",filter:"Filter",columns:"Columns"},columns:!0,sortable:!0,filterable:!0},destroy:function(){var a=this;a.filterMenu&&(a.filterMenu.destroy(),a.filterMenu=null),a.wrapper.children().removeData(q),a.wrapper.removeData(o).remove(),a.link.unbind(m,a._clickHandler),a.element.removeData("kendoColumnMenu"),a.columns=null},close:function(){this.menu.close(),this.popup.close()},_click:function(a){a.preventDefault(),a.stopPropagation(),this.popup.toggle()},_open:function(){a(".k-column-menu").not(this.wrapper).each(function(){a(this).data(o).close()})},_ownerColumns:function(){var a=this.owner.columns,b=g(a,function(a){var b=!0,c=s(a.title||"");if(a.menu===!1||!a.field&&!c.length)b=!1;return b});return h(b,function(b){return{field:b.field,title:b.title||b.field,hidden:b.hidden,index:i(b,a)}})},_menu:function(){this.menu=this.wrapper.children()[q]({orientation:"vertical",closeOnClick:!1}).data(q)},_sort:function(){var b=this;b.options.sortable&&(b.refresh(),b.options.dataSource.bind(n,e(b.refresh,b)),b.menu.element.delegate(".k-sort-asc, .k-sort-desc",m,function(){var c=a(this),d=c.hasClass("k-sort-asc")?k:l;c.parent().find(".k-sort-"+(d==k?l:k)).removeClass(j),b._sortDataSource(c,d),b.close()}))},_sortDataSource:function(a,c){var d=this,e=d.options.sortable,f=d.options.dataSource,g,h,i=f.sort()||[];a.hasClass(j)&&e&&e.allowUnsort!==!1?(a.removeClass(j),c=b):a.addClass(j);if(e===!0||e.mode==="single")i=[{field:d.field,dir:c}];else{for(g=0,h=i.length;g