www-thermferm/jqwidgets/jqxgrid.sort.js

changeset 511
2d1d43c3a2c2
parent 373
f6850e0b5d35
child 617
b216f9d4b917
--- a/www-thermferm/jqwidgets/jqxgrid.sort.js	Fri May 19 16:34:21 2017 +0200
+++ b/www-thermferm/jqwidgets/jqxgrid.sort.js	Sun May 28 14:19:57 2017 +0200
@@ -1,7 +1,7 @@
 /*
-jQWidgets v3.8.0 (2015-Apr)
-Copyright (c) 2011-2015 jQWidgets.
+jQWidgets v4.5.2 (2017-May)
+Copyright (c) 2011-2017 jQWidgets.
 License: http://jqwidgets.com/license/
-*/
-
-(function(a){a.jqx.dataview.sort=function(){this.sortby=function(d,f,p){var m=Object.prototype.toString;if(f==null){this.sortdata=null;this.refresh();return}if(f==undefined){f=true}if(f=="a"||f=="asc"||f=="ascending"||f==true){f=true}else{f=false}var g=d;this.sortfield=d;this.sortfielddirection=f?"asc":"desc";if(this.sortcache==undefined){this.sortcache={}}this.sortdata=[];var b=[];var c=false;if(g=="constructor"){g=""}if(!this.virtualmode&&this.sortcache[g]!=null){var o=this.sortcache[g];b=o._sortdata;if(o.direction==f){b.reverse()}else{if(!o.direction&&f){b.reverse()}c=true}if(b.length<this.totalrecords){this.sortcache={};c=false;b=[]}}Object.prototype.toString=(typeof d=="function")?d:function(){return this[d]};var r=this.records;var t=this.that;var n="";if(this.source.datafields){a.each(this.source.datafields,function(){if(this.name==d){if(this.type){n=this.type}return false}})}if(b.length==0){if(r.length){var h=r.length;for(var q=0;q<h;q++){var e=r[q];if(e!=null){var j=e;var s=j.toString();b.push({sortkey:s,value:j,index:q})}}}else{var l=false;for(obj in r){var e=r[obj];if(e==undefined){l=true;break}var j=e;b.push({sortkey:j.toString(),value:j,index:obj})}if(l){a.each(r,function(u,v){b.push({sortkey:v.toString(),value:v,index:u})})}}}if(!c){if(p==null){this._sortcolumntype=n;var k=this;b.sort(function(u,i){return k._compare(u,i,n)})}else{b.sort(p)}}if(!f){b.reverse()}Object.prototype.toString=m;this.sortdata=b;this.sortcache[g]={_sortdata:b,direction:f};this.reload(this.records,this.rows,this.filters,this.updated,true)},this.clearsortdata=function(){this.sortcache={};this.sortdata=null};this._compare=function(c,b,e){var c=c.sortkey;var b=b.sortkey;if(c===undefined){c=null}if(b===undefined){b=null}if(c===null&&b===null){return 0}if(c===null&&b!==null){return -1}if(c!==null&&b===null){return 1}if(a.jqx.dataFormat){if(e&&e!=""){switch(e){case"number":case"int":case"float":if(c<b){return -1}if(c>b){return 1}return 0;case"date":case"time":if(c<b){return -1}if(c>b){return 1}return 0;case"string":case"text":c=String(c).toLowerCase();b=String(b).toLowerCase();break}}else{if(a.jqx.dataFormat.isNumber(c)&&a.jqx.dataFormat.isNumber(b)){if(c<b){return -1}if(c>b){return 1}return 0}else{if(a.jqx.dataFormat.isDate(c)&&a.jqx.dataFormat.isDate(b)){if(c<b){return -1}if(c>b){return 1}return 0}else{if(!a.jqx.dataFormat.isNumber(c)&&!a.jqx.dataFormat.isNumber(b)){c=String(c).toLowerCase();b=String(b).toLowerCase()}}}}}try{if(c<b){return -1}if(c>b){return 1}}catch(d){var f=d}return 0};this._equals=function(c,b){return(this._compare(c,b)===0)}};a.extend(a.jqx._jqxGrid.prototype,{_rendersortcolumn:function(){var b=this.that;var d=this.getsortcolumn();if(this.sortdirection){var c=function(f,g){var e=b.getcolumn(f);if(e){if(g.ascending){a.jqx.aria(e.element,"aria-sort","ascending")}else{if(g.descending){a.jqx.aria(e.element,"aria-sort","descending")}else{a.jqx.aria(e.element,"aria-sort","none")}}}};if(this._oldsortinfo){if(this._oldsortinfo.column){c(this._oldsortinfo.column,{ascending:false,descending:false})}}c(d,this.sortdirection)}this._oldsortinfo={column:d,direction:this.sortdirection};if(this.sortdirection){a.each(this.columns.records,function(f,g){var e=a.data(document.body,"groupsortelements"+this.displayfield);if(d==null||this.displayfield!=d){a(this.sortasc).hide();a(this.sortdesc).hide();if(e!=null){e.sortasc.hide();e.sortdesc.hide()}}else{if(b.sortdirection.ascending){a(this.sortasc).show();a(this.sortdesc).hide();if(e!=null){e.sortasc.show();e.sortdesc.hide()}}else{a(this.sortasc).hide();a(this.sortdesc).show();if(e!=null){e.sortasc.hide();e.sortdesc.show()}}}})}},getsortcolumn:function(){if(this.sortcolumn!=undefined){return this.sortcolumn}return null},removesort:function(){this.sortby(null)},sortby:function(d,g,f,e,b){if(this._loading&&b!==false){throw new Error("jqxGrid: "+this.loadingerrormessage);return false}if(d==null){g=null;d=this.sortcolumn}if(d!=undefined){var c=this.that;if(f==undefined&&c.source.sortcomparer!=null){f=c.source.sortcomparer}if(g=="a"||g=="asc"||g=="ascending"||g==true){ascending=true}else{ascending=false}if(g!=null){c.sortdirection={ascending:ascending,descending:!ascending}}else{c.sortdirection={ascending:false,descending:false}}if(g!=null){c.sortcolumn=d}else{c.sortcolumn=null}if(c.source.sort||c.virtualmode){c.dataview.sortfield=d;if(g==null){c.dataview.sortfielddirection=""}else{c.dataview.sortfielddirection=ascending?"asc":"desc"}if(c.source.sort&&!this._loading){c.source.sort(d,g);c._raiseEvent(6,{sortinformation:c.getsortinformation()});return}}else{c.dataview.sortby(d,g,f)}if(e===false){return}if(c.groupable&&c.groups.length>0){c._render(true,false,false);if(c._updategroupheadersbounds&&c.showgroupsheader){c._updategroupheadersbounds()}}else{if(c.pageable){c.dataview.updateview()}c._updaterowsproperties();c.rendergridcontent(true)}c._raiseEvent(6,{sortinformation:c.getsortinformation()})}},_togglesort:function(d){var b=this.that;if(this.disabled){return}if(d.sortable&&b.sortable){var c=b.getsortinformation();var e=null;if(c.sortcolumn!=null&&c.sortcolumn==d.displayfield){e=c.sortdirection.ascending;if(b.sorttogglestates>1){if(e==true){e=false}else{e=null}}else{e=!e}}else{e=true}b.sortby(d.displayfield,e,null)}}})})(jqxBaseFramework);
\ No newline at end of file
+*/
+!function(a){a.jqx.dataview.sort=function(){this.sortby=function(b,c,d){var e=Object.prototype.toString;if(null==c)return this.sortdata=null,this.sortcache={},this.grid._pagescache=new Array,this.grid._cellscache=new Array,void this.refresh();void 0==c&&(c=!0),c="a"==c||"asc"==c||"ascending"==c||1==c;var f=b;this.sortfield=b,this.sortfielddirection=c?"asc":"desc",void 0==this.sortcache&&(this.sortcache={}),this.sortdata=[];var g=[],h=!1;if("constructor"==f&&(f=""),!this.virtualmode&&null!=this.sortcache[f]){var i=this.sortcache[f];g=i._sortdata,i.direction==c?g.reverse():(!i.direction&&c&&g.reverse(),h=!0),g.length<this.totalrecords&&(this.sortcache={},h=!1,g=[])}Object.prototype.toString="function"==typeof b?b:function(){return this[b]};var j=this.records,k=(this.that,"");if(this.source.datafields&&a.each(this.source.datafields,function(){if(this.name==b)return this.type&&(k=this.type),!1}),0==g.length)if(j.length)for(var l=j.length,m=0;m<l;m++){var n=j[m];if(null!=n){var o=n,p=o.toString();g.push({sortkey:p,value:o,index:m})}}else{var q=!1;for(obj in j){var n=j[obj];if(void 0==n){q=!0;break}var o=n;g.push({sortkey:o.toString(),value:o,index:obj})}q&&a.each(j,function(a,b){g.push({sortkey:b.toString(),value:b,index:a})})}if(!h)if(null==d){this._sortcolumntype=k;var r=this;g.sort(function(a,b){return r._compare(a,b,k)})}else g.sort(d);c||g.reverse(),Object.prototype.toString=e,this.sortdata=g,this.sortcache[f]={_sortdata:g,direction:c},this.reload(this.records,this.rows,this.filters,this.updated,!0)},this.clearsortdata=function(){this.sortcache={},this.sortdata=null},this._compare=function(b,c,d){var b=b.sortkey,c=c.sortkey;if(void 0===b&&(b=null),void 0===c&&(c=null),null===b&&null===c)return 0;if(null===b&&null!==c)return-1;if(null!==b&&null===c)return 1;if(a.jqx.dataFormat)if(d&&""!=d)switch(d){case"number":case"int":case"float":return b<c?-1:b>c?1:0;case"date":case"time":return b<c?-1:b>c?1:0;case"string":case"text":b=String(b).toLowerCase(),c=String(c).toLowerCase()}else{if(a.jqx.dataFormat.isNumber(b)&&a.jqx.dataFormat.isNumber(c))return b<c?-1:b>c?1:0;if(a.jqx.dataFormat.isDate(b)&&a.jqx.dataFormat.isDate(c))return b<c?-1:b>c?1:0;a.jqx.dataFormat.isNumber(b)||a.jqx.dataFormat.isNumber(c)||(b=String(b).toLowerCase(),c=String(c).toLowerCase())}try{if(b<c)return-1;if(b>c)return 1}catch(a){}return 0},this._equals=function(a,b){return 0===this._compare(a,b)}},a.extend(a.jqx._jqxGrid.prototype,{_rendersortcolumn:function(){var b=this.that,c=this.getsortcolumn();if(this.sortdirection){var d=function(c,d){var e=b.getcolumn(c);e&&(d.ascending?a.jqx.aria(e.element,"aria-sort","ascending"):d.descending?a.jqx.aria(e.element,"aria-sort","descending"):a.jqx.aria(e.element,"aria-sort","none"))};this._oldsortinfo&&this._oldsortinfo.column&&d(this._oldsortinfo.column,{ascending:!1,descending:!1}),d(c,this.sortdirection)}this._oldsortinfo={column:c,direction:this.sortdirection},this.sortdirection&&a.each(this.columns.records,function(d,e){var f=a.data(document.body,"groupsortelements"+this.displayfield);null==c||this.displayfield!=c?(a(this.sortasc).hide(),a(this.sortdesc).hide(),null!=f&&(f.sortasc.hide(),f.sortdesc.hide())):b.sortdirection.ascending?(a(this.sortasc).show(),a(this.sortdesc).hide(),null!=f&&(f.sortasc.show(),f.sortdesc.hide())):(a(this.sortasc).hide(),a(this.sortdesc).show(),null!=f&&(f.sortasc.hide(),f.sortdesc.show()))})},getsortcolumn:function(){return void 0!=this.sortcolumn?this.sortcolumn:null},removesort:function(){this.sortby(null)},sortby:function(a,b,c,d,e){if(this._loading&&e!==!1)throw new Error("jqxGrid: "+this.loadingerrormessage);if(null==a&&(b=null,a=this.sortcolumn),void 0!=a){var f=this.that;if(void 0==c&&null!=f.source.sortcomparer&&(c=f.source.sortcomparer),"a"==b||"asc"==b||"ascending"==b||1==b?ascending=!0:ascending=!1,null!=b?f.sortdirection={ascending:ascending,descending:!ascending}:f.sortdirection={ascending:!1,descending:!1},null!=b?f.sortcolumn=a:f.sortcolumn=null,f.source.sort||f.virtualmode){if(f.dataview.sortfield=a,null==b?f.dataview.sortfielddirection="":f.dataview.sortfielddirection=ascending?"asc":"desc",f.source.sort&&!this._loading)return f.source.sort(a,b),void f._raiseEvent(6,{sortinformation:f.getsortinformation()})}else f.dataview.sortby(a,b,c);if(d===!1)return;f.groupable&&f.groups.length>0?(f._render(!0,!1,!1),f._updategroupheadersbounds&&f.showgroupsheader&&f._updategroupheadersbounds(),f._postrender("sort")):(f.pageable&&f.dataview.updateview(),f._updaterowsproperties(),f.rendergridcontent(!0),f._postrender("sort")),f._raiseEvent(6,{sortinformation:f.getsortinformation()})}},_togglesort:function(a){var b=this.that;if(!this.disabled&&a.sortable&&b.sortable){var c=b.getsortinformation(),d=null;null!=c.sortcolumn&&c.sortcolumn==a.displayfield?(d=c.sortdirection.ascending,d=b.sorttogglestates>1?1!=d&&null:!d):d=!0,b.sortby(a.displayfield,d,null)}}})}(jqxBaseFramework);
+

mercurial