dhtmlxgrid导出的js_dhtmlxgrid.js 源代码在线查看 - dhtmlxGrid 是跨浏览器的 JavaScript 表格控制组件(Grid Control) 资源下载 虫虫电子下...

*/ this.setInitWidthsP = function(wp){ this.cellWidthType = "%"; this.initCellWidth = wp.split(this.delim.replace(/px/gi,"")); var el=window; var self=this; if(el.addEventListener){ if ((_isFF)&&(_FFrv el.addEventListener("resize",function (){ if (!self.entBox) return; var z=self.entBox.style.width; self.entBox.style.width="1px"; window.setTimeout(function(){ self.entBox.style.width=z; self.setSizes(); },10); },false); else el.addEventListener("resize",function (){ if (self.setSizes) self.setSizes(); },false); } else if (el.attachEvent) el.attachEvent("onresize",function(){ if (self._resize_timer) window.clearTimeout(self._resize_timer); if (self.setSizes) self._resize_timer=window.setTimeout(function(){ self.setSizes(); },500); }); } /** * @desc: set width of columns in pixels * @type: public * @before_init: 1 * @param: wp - width in pixels * @topic: 0,7 */ this.setInitWidths = function(wp){ this.cellWidthType = "px"; this.initCellWidth = wp.split(this.delim); if (_isFF){ for (var i=0; iif (this.initCellWidth[i]!="*") this.initCellWidth[i]=parseInt(this.initCellWidth[i])-2; } } /** * @desc: set multiline rows support to enabled or disabled state * @type: public * @before_init: 1 * @param: state - true or false * @topic: 0,7 */ this.enableMultiline = function(state){ this.multiLine = convertStringToBoolean(state); } /** * @desc: set multiselect mode to enabled or disabled state * @type: public * @param: state - true or false * @topic: 0,7 */ this.enableMultiselect = function(state){ this.selMultiRows = convertStringToBoolean(state); } /** * @desc: set path to grid internal images (sort direction, any images used in editors, checkbox, radiobutton) * @type: public * @param: path - path to images folder with closing "/" * @topic: 0,7 */ this.setImagePath = function(path){ this.imgURL = path; } /** * @desc: part of column resize routine * @type: private * @param: ev - event * @topic: 3 */ this.changeCursorState = function (ev){ var el = ev.target||ev.srcElement; if(el.tagName!="TD") el = this.getFirstParentOfType(el,"TD") if ((el.tagName=="TD")&&(this._drsclmn)&&(!this._drsclmn[el._cellIndex])) return; if((el.offsetWidth - (ev.offsetX||(parseInt(this.getPosition(el,this.hdrBox))-ev.layerX)*-1)) el.style.cursor = "E-resize"; }else el.style.cursor = "default"; if (_isOpera) this.hdrBox.scrollLeft = this.objBox.scrollLeft; } /** * @desc: part of column resize routine * @type: private * @param: ev - event * @topic: 3 */ this.startColResize = function(ev){ this.resized = null; var el = ev.target||ev.srcElement; if(el.tagName!="TD") el = this.getFirstParentOfType(el,"TD") var x = ev.clientX; var tabW = this.hdr.offsetWidth; var startW = parseInt(el.offsetWidth) if(el.tagName=="TD" && el.style.cursor!="default"){ if ((this._drsclmn)&&(!this._drsclmn[el._cellIndex])) return; this.entBox.onmousemove = function(e){this.grid.doColResize(e||window.event,el,startW,x,tabW)} document.body.onmouseup = new Function("","document.getElementById('"+this.entBox.id+"').grid.stopColResize()"); } } /** * @desc: part of column resize routine * @type: private * @param: ev - event * @topic: 3 */ this.stopColResize = function(){ this.entBox.onmousemove = "";//removeEventListener("mousemove")// document.body.onmouseup = ""; this.setSizes(); this.doOnScroll(0,1) if (this.onRSE) this.onRSE(this); } /** * @desc: part of column resize routine * @param: el - element (column resizing) * @param: startW - started width * @param: x - x coordinate to resize from * @param: tabW - started width of header table * @type: private * @topic: 3 */ this.doColResize = function(ev,el,startW,x,tabW){ el.style.cursor = "E-resize"; this.resized = el; var fcolW = startW + (ev.clientX-x); var wtabW = tabW + (ev.clientX-x) if ((this.onRSI)&&(!this.onRSI(el._cellIndex,fcolW,this))) return; if (el.colSpan>1){ var a_sizes=new Array(); for (var i=0; i a_sizes[i]=Math.round(fcolW*this.hdr.rows[0].childNodes[el._cellIndexS+i].offsetWidth/el.offsetWidth); for (var i=0; i this._setColumnSizeR(el._cellIndexS+i*1,a_sizes[i]); } else this._setColumnSizeR(el._cellIndex,fcolW); this.doOnScroll(0,1); if (_isOpera) this.setSizes(); this.objBuf.childNodes[0].style.width = ""; } /** * @desc: set width of grid columns ( zero row of header and body ) * @type: private * @topic: 7 */ this._setColumnSizeR=function(ind, fcolW){ if(fcolW>(this._drsclmW?(this._drsclmW[ind]||10):10)){ this.obj.firstChild.firstChild.childNodes[ind].style.width = fcolW+"px"; this.hdr.rows[0].childNodes[ind].style.width = fcolW+"px";if (this.ftr)this.ftr.rows[0].childNodes[ind].style.width = fcolW+"px"; if(this.cellWidthType=='px'){ this.cellWidthPX[ind]=fcolW; }else{ var gridWidth = parseInt(this.entBox.offsetWidth); if (this.objBox.scrollHeight>this.objBox.offsetHeight) gridWidth-=(this._scrFix||(_isFF?19:16)); var pcWidth = Math.round(fcolW/gridWidth*100) this.cellWidthPC[ind]=pcWidth; } } } /** * @desc: sets position and visibility of sort image * @param: [state] - true/false - show/hide image * @param: [ind] - index of field * @param: [direction] - ASC/DESC - type of image * @type: public * @topic: 7 */ this.setSortImgState=function(state,ind,direction){ if (!convertStringToBoolean(state)){ this.sortImg.style.display = "none"; return; } if (direction=="ASC") this.sortImg.src = this.imgURL+"sort_asc.gif"; else this.sortImg.src = this.imgURL+"sort_desc.gif"; this.sortImg.style.display=""; this.fldSorted=this.hdr.rows[0].cells[ind]; this.setSortImgPos(ind); } /** * @desc: sets position and visibility of sort image * @param: [ind] - index of field * @type: private * @topic: 7 */ this.setSortImgPos = function(ind,mode){ if(!ind) var el = this.fldSorted; else var el = this.hdr.rows[0].cells[ind]; if(el!=null){ var pos = this.getPosition(el,this.hdrBox) var wdth = el.offsetWidth; this.sortImg.style.left = Number(pos[0]+wdth-13)+"px";//Number(pos[0]+5)+"px"; this.sortImg.defLeft = parseInt(this.sortImg.style.left) this.sortImg.style.top = Number(pos[1]+5)+"px"; if ((!this.useImagesInHeader)&&(!mode)) this.sortImg.style.display = "inline"; this.sortImg.style.left = this.sortImg.defLeft+"px";//-parseInt(this.hdrBox.scrollLeft) } } /** * @desc: manage activity of the grid. * @param: fl - true to activate,false to deactivate * @type: private * @topic: 1,7 */ this.setActive = function(fl){ if(arguments.length==0) var fl = true; if(fl==true){ //document.body.onkeydown = new Function("","document.getElementById('"+this.entBox.id+"').grid.doKey()")// globalActiveDHTMLGridObject = this; this.isActive = true; }else{ this.isActive = false; } }; /** * @desc: called on click occured * @type: private */ this._doClick = function(ev){ var selMethod = 0; var el = this.getFirstParentOfType(_isIE?ev.srcElement:ev.target,"TD"); var fl = true; if(this.selMultiRows!=false){ if(ev.shiftKey && this.row!=null){ selMethod = 1; } if(ev.ctrlKey){ selMethod = 2; } } this.doClick(el,fl,selMethod) }; /** * @desc: called onmousedown inside grid area * @type: private */ this._doContClick=function(ev){ var el = this.getFirstParentOfType(_isIE?ev.srcElement:ev.target,"TD"); if ((!el)||(el.parentNode.idd===undefined)) return true; if (ev.button==2){if ((this.onRCL)&&(!this.onRCL(el.parentNode.idd,el._cellIndex,ev))) return;if (this._ctmndx){ if ((this.onBCM)&&(!this.onBCM(el.parentNode.idd,el._cellIndex,this))) return true; el.contextMenuId=el.parentNode.idd+"_"+el._cellIndex; el.contextMenu=this._ctmndx; el.a=this._ctmndx._contextStart; if (_isIE) ev.srcElement.oncontextmenu = function(){ event.cancelBubble=true; return false; }; el.a(el,ev); el.a=null; } } return true; } /** * @desc: occures on cell click (supports treegrid) * @param: [el] - cell to click on * @param: [fl] - true if to call onRowSelect function * @param: [selMethod] - 0 - simple click, 1 - shift, 2 - ctrl * @type: private * @topic: 1,2,4,9 */ this.doClick = function(el,fl,selMethod){ var psid=this.row?this.row.idd:0; this.setActive(true); if(!selMethod) selMethod = 0; if(this.cell!=null) this.cell.className = this.cell.className.replace(/cellselected/g,""); if(el.tagName=="TD" && (this.rowsCol._dhx_find(this.rowsAr[el.parentNode.idd])!=-1 || this.rowsBuffer[0]._dhx_find(el.parentNode.idd)!=-1)){ if (this.onSSC) var initial=this.getSelectedId(); var prow=this.row; if(selMethod==0){

dhtmlxGrid 启用Ajax的JavaScript网格控制与尖端功能,强大的数据绑定,并与大型数据集的出色表现 。组件是易于使用,并提供了极大的灵活性,由于其丰富的客户端 API 。dhtmlxGrid支持不同的数据源(XML,JSON,CSV,JavaScript数组,和HTML表格),也可以从自定义的XML格式加载。 网格组件可以轻松实现丰富的单元格内编辑和内置的好看的DHTML表(通过CSS或预定义的皮肤管理),过滤、搜索和分组功能。众多的事件处理程序,可以添加必要的交互性到您的基于网格 的接口。智能渲染和分页支持,让这个JavaScript的DataGrid有效地开展工作,甚至与庞大的数据集。 作为一个100%的客户端的JavaScript解决方案,dhtmlxGrid可以集成与任何服务器端技术(PHP,JAVA的Ruby - on – Rails等 )。dhtmlxConnector库Ajax支持,提供实时保存和更新服务器上的网格数据的情况下自动重新加载页面的能力。 dhtmlxGrid支持强大的功能,如必要的基于Web的电子表格、合并单元格、拆分模式、网格列拖动和拖放或脚本方法和数据复制到剪贴板(CSV格式) 。AJAX DataGrid的可扩展架构允许您使用自定义单元格编辑器(每一个细胞的基础上)的外部元件,提供的能力,极大地丰富了网格功能。 DHTMLX库的一部分,dhtmlxGrid可以很容易地与其他元件集成在一个共同的应用程序使用的接口 dhtmlxLayout。有了一个新的皮肤,在2.5版 本中引入,所有DHTMLX组件了光滑和干净的外观,它可以完全匹配任何现代的网站或应用程序的设计。 dhtmlxGrid表格展现通过加载XML文件来载入表头、表尾、表格数据实现展现、操作、回写功能。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值