EOS/Scripts/kendo/2015.3.1111/kendo.columnsorter.min.js
Nidhi Bhargava f0c1ab20e1 code push
2025-09-04 16:25:07 +05:30

9 lines
2.1 KiB
JavaScript

/*
* Kendo UI v2015.3.1111 (http://www.telerik.com/kendo-ui)
* Copyright 2015 Telerik AD. All rights reserved.
*
* Kendo UI commercial licenses may be obtained at
* http://www.telerik.com/purchase/license-agreement/kendo-ui-complete
* If you do not own a commercial license, this file shall be governed by the trial license terms.
*/
!function(e,define){define(["./kendo.core.min"],e)}(function(){return function(e,t){var n=window.kendo,i=n.ui,r=i.Widget,o="dir",a="asc",s="single",l="field",c="desc",u=".kendoColumnSorter",d=".k-link",h="aria-sort",f=e.proxy,p=r.extend({init:function(e,t){var n,i=this;r.fn.init.call(i,e,t),i._refreshHandler=f(i.refresh,i),i.dataSource=i.options.dataSource.bind("change",i._refreshHandler),n=i.element.find(d),n[0]||(n=i.element.wrapInner('<a class="k-link" href="#"/>').find(d)),i.link=n,i.element.on("click"+u,f(i._click,i))},options:{name:"ColumnSorter",mode:s,allowUnsort:!0,compare:null,filter:""},destroy:function(){var e=this;r.fn.destroy.call(e),e.element.off(u),e.dataSource.unbind("change",e._refreshHandler),e._refreshHandler=e.element=e.link=e.dataSource=null},refresh:function(){var t,i,r,s,u=this,d=u.dataSource.sort()||[],f=u.element,p=f.attr(n.attr(l));for(f.removeAttr(n.attr(o)),f.removeAttr(h),t=0,i=d.length;i>t;t++)r=d[t],p==r.field&&f.attr(n.attr(o),r.dir);s=f.attr(n.attr(o)),f.find(".k-i-arrow-n,.k-i-arrow-s").remove(),s===a?(e('<span class="k-icon k-i-arrow-n" />').appendTo(u.link),f.attr(h,"ascending")):s===c&&(e('<span class="k-icon k-i-arrow-s" />').appendTo(u.link),f.attr(h,"descending"))},_click:function(e){var i,r,u=this,d=u.element,h=d.attr(n.attr(l)),f=d.attr(n.attr(o)),p=u.options,g=null===u.options.compare?t:u.options.compare,m=u.dataSource.sort()||[];if(e.preventDefault(),!p.filter||d.is(p.filter)){if(f=f===a?c:f===c&&p.allowUnsort?t:a,p.mode===s)m=[{field:h,dir:f,compare:g}];else if("multiple"===p.mode){for(i=0,r=m.length;r>i;i++)if(m[i].field===h){m.splice(i,1);break}m.push({field:h,dir:f,compare:g})}this.dataSource.sort(m)}}});i.plugin(p)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t){t()});