org.wicketstuff.datatables.media.js.AutoFill.min.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wicketstuff-datatables Show documentation
Show all versions of wicketstuff-datatables Show documentation
DataTables jQuery integration for Wicket
/*
* File: AutoFill.min.js
* Version: 1.1.1
* Author: Allan Jardine (www.sprymedia.co.uk)
*
* Copyright 2010 Allan Jardine, all rights reserved.
*
* This source file is free software, under either the GPL v2 license or a
* BSD (3 point) style license, as supplied with this software.
*
* This source file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
*/
var AutoFill;
(function(d){AutoFill=function(b,a){if(!this.CLASS||this.CLASS!="AutoFill")alert("Warning: AutoFill must be initialised with the keyword 'new'");else if(d.fn.dataTableExt.fnVersionCheck("1.7.0")){this.s={filler:{height:0,width:0},border:{width:2},drag:{startX:-1,startY:-1,startTd:null,endTd:null,dragging:false},screen:{interval:null,y:0,height:0,scrollTop:0},scroller:{top:0,bottom:0},columns:[]};this.dom={table:null,filler:null,borderTop:null,borderRight:null,borderBottom:null,borderLeft:null,currentTarget:null};
this.fnSettings=function(){return this.s};this._fnInit(b,a);return this}else alert("Warning: AutoFill requires DataTables 1.7 or greater - www.datatables.net/download")};AutoFill.prototype={_fnInit:function(b,a){var c=this,e;this.s.dt=b.fnSettings();this.dom.table=this.s.dt.nTable;b=0;for(e=this.s.dt.aoColumns.length;btr>td",this.dom.table).live("mouseover mouseout",function(f){c._fnFillerDisplay.call(c,f)})},_fnColumnDefs:function(b){var a,c,e,f,
h,g;for(a=b.length-1;a>=0;a--){g=b[a].aTargets;c=0;for(f=g.length;c=0)this._fnColumnOptions(g[c],b[a]);else if(typeof g[c]=="number"&&g[c]<0)this._fnColumnOptions(this.s.dt.aoColumns.length+g[c],b[a]);else if(typeof g[c]=="string"){e=0;for(h=this.s.dt.aoColumns.length;ea.s.scroller.bottom-50)d(a.s.dt.nTable.parentNode).animate({scrollTop:d(a.s.dt.nTable.parentNode).scrollTop()+50},240,"linear");else a.s.screen.ytr:eq("+a.y+")>td:eq("+this.s.drag.startX+")",this.dom.table)[0];a=this._fnTargetCoords(b.target)}if(a.x==this.s.drag.startX){var c=this.s.drag;c.endTd=b.target;a.y>=this.s.drag.startY?this._fnUpdateBorder(c.startTd,c.endTd):this._fnUpdateBorder(c.endTd,c.startTd);this._fnFillerPosition(b.target)}}this.s.screen.y=b.pageY;this.s.screen.scrollTop=d(document).scrollTop();if(this.s.dt.oScroll.sY!==""){this.s.scroller.scrollTop=
d(this.s.dt.nTable.parentNode).scrollTop();this.s.scroller.top=d(this.s.dt.nTable.parentNode).offset().top;this.s.scroller.bottom=this.s.scroller.top+d(this.s.dt.nTable.parentNode).height()}},_fnFillerFinish:function(){d(document).unbind("mousemove.AutoFill");d(document).unbind("mouseup.AutoFill");this.dom.borderTop.style.display="none";this.dom.borderRight.style.display="none";this.dom.borderBottom.style.display="none";this.dom.borderLeft.style.display="none";this.s.drag.dragging=false;clearInterval(this.s.screen.interval);
var b=this._fnTargetCoords(this.s.drag.startTd),a=this._fnTargetCoords(this.s.drag.endTd),c=[],e;if(b.y<=a.y){e=true;for(i=b.y;i<=a.y;i++)c.push(d("tbody>tr:eq("+i+")>td:eq("+b.x+")",this.dom.table)[0])}else{e=false;for(i=b.y;i>=a.y;i--)c.push(d("tbody>tr:eq("+i+")>td:eq("+b.x+")",this.dom.table)[0])}b=b.x;a=false;var f=[],h=this._fnPrep(this.s.columns[b].read.call(this,this.s.drag.startTd));i=0;for(iLen=c.length;i0)return d(a).val();a=d("select",b);if(a.length>0)return d(a).val();return b.innerHTML},_fnWriteCell:function(b,a,c){var e=d("input",b);if(e.length>0)d(e).val(a);else{e=d("select",b);if(e.length>0)d(e).val(a);else{b=this.s.dt.oInstance.fnGetPosition(b);this.s.dt.oInstance.fnUpdate(a,b[0],b[2],c)}}},_fnFillerDisplay:function(b){if(!this.s.drag.dragging)if(this.s.columns[this._fnTargetCoords(b.target).x].enable){var a=
this.dom.filler;if(b.type=="mouseover"){this.dom.currentTarget=b.target;this._fnFillerPosition(b.target);a.style.display="block"}else if(!b.relatedTarget||!b.relatedTarget.className.match(/AutoFill/))a.style.display="none"}},_fnFillerPosition:function(b){var a=d(b).offset(),c=this.dom.filler;c.style.top=a.top-this.s.filler.height/2-1+d(b).outerHeight()+"px";c.style.left=a.left-this.s.filler.width/2-1+d(b).outerWidth()+"px"}};AutoFill.prototype.CLASS="AutoFill";AutoFill.VERSION="1.1.1";AutoFill.prototype.VERSION=
"1.1.1"})(jQuery);
© 2015 - 2025 Weber Informatics LLC | Privacy Policy