⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 igf_grid.js

📁 一个JSF的商业组件的DEMO,infragistics-netadvantage.lic:NetAdvantage for JSF Vol1 2008,m21A99D6A11FF-9B33DC4B8
💻 JS
📖 第 1 页 / 共 4 页
字号:
bdy.setSize(w,null);}
if(!ig.isNull(cftr)){cftr.setSize(w,null);}};IgGrid.prototype.getScrollBarWidth=function(){if(ig.grid.scrollbarWidth==null){document.body.style.overflow='hidden';var width=document.body.clientWidth;document.body.style.overflow='scroll';width-=document.body.clientWidth;if(!width)width=document.body.offsetWidth-document.body.clientWidth;document.body.style.overflow='';ig.grid.scrollbarWidth=width;}
return ig.grid.scrollbarWidth;};IgGrid.prototype.scrollTo=function(x,y){if(ig.isNumber(x)||ig.isNumber(y)){var SCROLL_IN_PROGRESS="igstip";if(!ig.NaES(this.getAttribute(SCROLL_IN_PROGRESS))){this.setAttribute(SCROLL_IN_PROGRESS,"t");var hdr=this.getColumnsHeader();if(!ig.isNull(hdr)){hdr.scrollTo(x);}
var bdy=this.getBody();if(!ig.isNull(bdy)){bdy.scrollTo(x,y);}
var ftr=this.getColumnsFooter();if(!ig.isNull(ftr)){ftr.scrollTo(x);}
this.setAttribute(SCROLL_IN_PROGRESS,"");}}};IgGrid.prototype.toScrollingGrid=function(table,cc,fc){var grd=null;if(!ig.isNull(table)){grd=document.createElement("div");grd.id=table.id;grd.className=table.className;grd.style.cssText="overflow: hidden; "+table.style.cssText;var gHeader=this.toGridHeaderFooterSection(this.getGridHeader());if(!ig.isNull(gHeader)){grd.appendChild(gHeader);}
var cHeader=this.toScrollingSection(table.tHead,fc,cc);var body=this.toScrollingSection(table.tBodies[0],fc,cc,"overflow: auto;",true);if(!ig.isNull(cHeader)){grd.appendChild(cHeader);}
if(!ig.isNull(body)){grd.appendChild(body);}
var gFooter=this.toGridHeaderFooterSection(this.getGridFooter());var cFooter=this.toScrollingSection(table.tFoot,fc,cc);if(!ig.isNull(cFooter)){grd.appendChild(cFooter);}
if(!ig.isNull(gFooter)){grd.appendChild(gFooter);}
grd=ig.getUIElementById(grd);this.setAttribute(ig.grid.PROP_IS_SCROLLING,"true");}
return grd;};IgGrid.prototype.toGridHeaderFooterSection=function(id){var result=null;if(!ig.isNull(id)){var tmp=ig.getUIElementById(id);if(!ig.isNull(tmp)){result=document.createElement("div");result.style.cssText="overflow: hidden;";var tmpId=tmp.elm.id;tmp.elm.id="";var table=this.createEmptyTable(tmpId,"border: 0px; margin: 0px; padding: 0px; width: 100%; empty-cells: show; border-collapse: collapse;");result.appendChild(table);var tableTBody=document.createElement("tbody");table.appendChild(tableTBody);tableTBody.appendChild(tmp.elm);}}
return result;};IgGrid.prototype.toScrollingSection=function(sec,fc,cc,css,rsl){var scrollingSection=null;if(!ig.isNull(sec)){var sc=cc-fc;scrollingSection=document.createElement("div");if(ig.NaES(css)){scrollingSection.style.cssText=css+"; overflow-x: hidden;";}
else{scrollingSection.style.cssText="overflow-x: hidden;";}
var twoColumnsTable=this.createEmptyTable(sec.id,"border: 0px; margin: 0px; padding: 0px;");scrollingSection.appendChild(twoColumnsTable);var tctblTBody=document.createElement("tbody");twoColumnsTable.appendChild(tctblTBody);var tctblTr=document.createElement("tr");tctblTr.vAlign="top";tctblTBody.appendChild(tctblTr);var fixedTd=document.createElement("td");tctblTr.appendChild(fixedTd);var fixedDiv=document.createElement("div");fixedDiv.style.cssText="overflow: hidden;";fixedTd.appendChild(fixedDiv);var fixedDivContent=document.createElement("div");fixedDiv.appendChild(fixedDivContent);var scrollingTd=document.createElement("td");tctblTr.appendChild(scrollingTd);var scrollingDiv=document.createElement("div");if(ig.NaES(css)){scrollingDiv.style.cssText=css;}
else{scrollingDiv.style.cssText="overflow: hidden";}
if(rsl==true){fixedDiv.onscroll=ig.ui.onScroll;scrollingDiv.onscroll=ig.ui.onScroll;}
scrollingTd.appendChild(scrollingDiv);var scrollingDivContent=document.createElement("div");scrollingDiv.appendChild(scrollingDivContent);var fixedTable=this.createEmptyTable(null,"border: 0px; margin: 0px; padding: 0px; table-layout: fixed; width: 0px; empty-cells: show; border-collapse: collapse;");fixedDivContent.appendChild(fixedTable);var ftb=document.createElement("tbody");fixedTable.appendChild(ftb);var scrollingTable=this.createEmptyTable(null,"border: 0px; margin: 0px; padding: 0px; overflow: hidden; table-layout: fixed; width: 0px; empty-cells: show; border-collapse: collapse;");scrollingDivContent.appendChild(scrollingTable);var stb=document.createElement("tbody");scrollingTable.appendChild(stb);if(!ig.isNull(sec.rows)){this.setScrollingGridRowCount(sec.rows.length);if(sec.rows.length>0){if(sec.rows[0].id.indexOf("cheaders")==-1){this.setSingleRowHeight(sec.rows[0].offsetHeight);}}
while(sec.rows.length>0){var r=ig.getUIElementById(sec.rows[0]);var rId=r.elm.id;var rHeight=r.getHeight();var rsize=r.getSize();stb.appendChild(r.elm);if(rHeight!=0)
r.setSize(null,rsize.height);r.elm.id=rId+"_sr";var rType=ig.getAttribute(r.elm,ig.PROP_TYPE);if(ig.NaES(rType)){ig.setAttribute(r.elm,ig.PROP_TYPE,ig.grid.TYPE_GRID_ROW_SCROLL);}
var ftr=ig.getUIElementById(document.createElement("TR"));ftr.elm.id=rId;ftr.elm.className=r.elm.className;ftr.elm.style.cssText=r.elm.style.cssText;if(rHeight!=ftr.getHeight())
ftr.setSize(null,rHeight);ftb.appendChild(ftr.elm);if(ig.NaES(rType)){ig.setAttribute(ftr.elm,ig.PROP_TYPE,ig.grid.TYPE_GRID_ROW);}
var cl=r.elm.cells.length;if(cl==0){var dcf=document.createElement("TD");dcf.colSpan=fc;ftr.elm.appendChild(dcf);}
var oflg=r.getAttribute(ig.PROP_FLAG);if(oflg=="igNested"){var ncdcf=document.createElement("TD");if(fc!=0)
ncdcf.colSpan=fc;ftr.elm.appendChild(ncdcf);}
else{for(var ci=0;ci<fc;ci++){if(ci<cl){var aci=r.elm.cells[0];aci.style.cssText=aci.style.cssText+"; overflow: hidden;";if(ig.getAttribute(aci,ig.PROP_TYPE)==ig.grid.TYPE_GRID_COLUMN_HEADER){aci.style.cssText=aci.style.cssText+";white-space:nowrap;";}
var colSpan=aci.colSpan;if(colSpan>1&&ci<fc){aci.colSpan=fc-ci;}
ftr.elm.appendChild(aci);}
else{}}}
var cl=r.elm.cells.length;if(cl==0){var dcs=document.createElement("TD");if(sc>0){dcs.colSpan=sc;}
r.elm.appendChild(dcs);}
for(var ci=0;ci<sc;ci++){if(ci<cl){var aci=r.elm.cells[ci];aci.style.cssText=aci.style.cssText+"; overflow: hidden;";if(ig.getAttribute(aci,ig.PROP_TYPE)==ig.grid.TYPE_GRID_COLUMN_HEADER){aci.style.cssText=aci.style.cssText+";white-space:nowrap;";}
var colSpan=aci.colSpan;if(colSpan>1&&ci<sc){aci.colSpan=sc-ci;}
ig.setAttribute(aci,ig.grid.PROP_IS_SCROLLING,"true");}
else{}}}}}
return scrollingSection;};IgGrid.prototype.onClick=function(evt){};IgGrid.prototype.onDoubleClick=function(evt){this.get_behaviors()._fireEvent(this.elm,evt);ig.ui.setActiveComponent(this);};IgGrid.prototype.onRowChange=function(evt){if(this.getUpdateMode()=="row"&&this.findEvent(this.getId(),"celledit")>=0){ig.smartSubmit(this.getId(),"rowedit",null,"messages");this.clearEventQueue();}}
IgGrid.prototype.get_cellFromPosition=function(position){if(ig.isNull(position)){return null;}
cell=this.getBody().getCell(position.row,position.col);if(!ig.isNull(cell)){return ig.grid.getTargetCell(cell.elm);}
return null;}
IgGrid.prototype.selectCell=function(row,col){var newCell=this.getBody().getCell(row,col);if(!ig.isNull(newCell)){newCell=new IgGridCell(newCell.elm);if(!ig.isNull(newCell)){newCell.select();if(this.isScrolling()){var cc=this.getColCount();var fcc=this.getFrozenColCount()
if(col>=fcc){var b=this.getBody().getScrollingDiv();if((newCell.elm.offsetLeft)<(b.elm.scrollLeft)){this.getBody().scrollTo(newCell.elm.offsetLeft);}
else if((newCell.elm.offsetLeft+newCell.elm.offsetWidth)>(b.elm.scrollLeft+b.getWidth())){this.getBody().scrollTo(newCell.elm.offsetLeft+newCell.elm.offsetWidth);}}}}}}
IgGrid.prototype.onKeyDown=function(evt){this.get_behaviors()._fireEvent(this.elm,evt);ig.ui.setActiveComponent(this);}
IgGrid.prototype.onKeyPress=function(evt){this.get_behaviors()._fireEvent(this.elm,evt);ig.ui.setActiveComponent(this);};IgGrid.prototype.getPrevCell=function(currentCell){var selectedCell=currentCell.getPosition();if(selectedCell.col==0&&selectedCell.row==0)
return null;else if(selectedCell.col==0){selectedCell.row=selectedCell.row-1;selectedCell.col=this.getColCount()-1;}
else
selectedCell.col=selectedCell.col-1;return this.get_cellFromPosition(selectedCell);}
IgGrid.prototype.getNextCell=function(currentCell){var selectedCell=currentCell.getPosition();if(selectedCell.col>=this.getColCount()-1){selectedCell.row=selectedCell.row+1;selectedCell.col=0;}else{selectedCell.col=selectedCell.col+1;}
return this.get_cellFromPosition(selectedCell);}
IgGrid.prototype.getNextCellVert=function(currentCell){var selectedCell=currentCell.getPosition();selectedCell.row=selectedCell.row+1;return this.get_cellFromPosition(selectedCell);}
IgGrid.prototype.getPrevCellVert=function(currentCell){var selectedCell=currentCell.getPosition();if(selectedCell.row==0)
return null;selectedCell.row=selectedCell.row-1;return this.get_cellFromPosition(selectedCell);}
IgGrid.prototype.hasActivation=function(){return(!ig.isNull(this.getAttribute("igactg")));}
IgGrid.prototype.hasEditing=function(){return(!ig.isNull(this.getAttribute("igeditg")));}
IgGrid.prototype.getEditMode=function(){return this.getAttribute("igeditm");}
IgGrid.prototype.getUpdateMode=function(){return this.getAttribute("igupdatem");}
IgGrid.prototype._initializeObjects=function(){}
ig.augment(IgGrid,IgUIComponent);function IgGridSection(e,grid){this.IgHtmlTable(e);this.grid=grid;};IgGridSection.prototype.adjustSizeFixedSection=function(){if(ig.isMozilla){var fcw=this.grid.getFrozenColumnsWidth();var fSec=this.getFixedSection();fSec.setSize(fcw);}
var body=this.grid.getBody();if(!ig.isNull(body)){var bsd=body.getScrollingDiv();if(!ig.isNull(bsd)){var bsdc=body.getScrollingDivContent();if(!ig.isNull(bsdc)){var bfd=body.getFixedDiv();if(!ig.isNull(bfd)){var bsdHeight=bsd.getHeight();bfd.setSize(null,bsdHeight);}
var bfdc=body.getFixedDivContent();if(!ig.isNull(bfdc)){var bsdcHeight=bsdc.getHeight();bfdc.setSize(null,bsdcHeight+50);}}}}};IgGridSection.prototype.adjustSizeScrollingSection=function(){if(ig.isMozilla){var sSec=this.getScrollingSection();var scw=this.grid.getScrollingColumnsWidth();sSec.setSize(scw);}
var sDiv=this.getScrollingDiv();if(!ig.isNull(sDiv)){var vscw=this.grid.getVisibleScrollingColumnsWidth();sDiv.setSize(vscw);}};IgGridSection.prototype.getCell=function(row,col){var result=null;row=this.fixRowIndex(row);if(ig.isNumber(row)&&ig.isNumber(col)){var r=this.getRow(row);var fcc=this.grid.getFrozenColCount();if(this.grid.isScrolling()&&ig.isNumber(fcc)){if(col>=fcc){var scol=col-fcc;var sSec=this.getScrollingSection();result=sSec.getCell(row,scol);}
else{var fSec=this.getFixedSection();result=fSec.getCell(row,col);}}
else{result=this.callSuper("IgHtmlTable","getCell",row,col);}}
return result;};IgGridSection.prototype.fixRowIndex=function(rowIndex){var rows=this.elm.rows;var nestedRows=0;if(ig.isArray(rows)){for(var i=0;i<=rowIndex&&i<rows.length;i++){var oflg=rows[i].getAttribute(ig.PROP_FLAG);if(oflg=="igNested"){rowIndex++;}}}
return rowIndex;};IgGridSection.prototype.getFixedSection=function(){return this.getSubsection(0);};IgGridSection.prototype.getScrollingSection=function(){return this.getSubsection(1);};IgGridSection.prototype.getFixedDiv=function(){var result=null;var tmp=this.getFixedDivContent();if(!ig.isNull(tmp)){result=ig.getUIElementById(tmp.elm.parentNode);}
return result;};IgGridSection.prototype.getFixedDivContent=function(){var result=null;var sec=this.getFixedSection();if(!ig.isNull(sec)){result=ig.getUIElementById(sec.elm.parentNode);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -