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

📄 grids.js

📁 ajax 框价.是个好工具.javascript 矿家.可以用在任何平台.
💻 JS
📖 第 1 页 / 共 5 页
字号:
throw new Error("Visual property on non created component");return this._gridBodyElement.clientHeight;};_p.setOverflowX=function(sOverflowX){if(this._overflowX!=sOverflowX){this._overflowX=sOverflowX;if(this._created)
this._gridBodyElement.style.overflowX=sOverflowX;}};_p.setOverflowY=function(sOverflowY){if(this._overflowY!=sOverflowY){this._overflowY=sOverflowY;if(this._created)
this._gridBodyElement.style.overflowY=sOverflowY;}};BiAbstractGrid.prototype.getOverflowX=function(){return this._overflowX;};BiAbstractGrid.prototype.getOverflowY=function(){return this._overflowY;};_p.sort=function(nCol,bAscending)
{if(!this.dispatchEvent(new BiEvent("beforesort")))
return;if(nCol!= -1){var f=this._columns[nCol].getSortFunction();}
this._sortColumn=nCol;this._ascending=Boolean(bAscending);this._headers.setSortColumn(nCol);this._headers.setAscending(bAscending);if(nCol!= -1){this._sort(f,bAscending);this.updateData();}
this.dispatchEvent(new BiEvent("sort"));};_p._sort=function(fCompare,bAscending){this._rows.sort(fCompare);if(!bAscending)
this._rows.reverse();};_p._onFocusChange=function(e){var items=this.getSelectedRows();for(var i=0;i<items.length;i++)
items[i]._updateClassName();if(this._selectionModel._leadItem)
this._selectionModel._leadItem._updateClassName();};_p._onKeyPress=function(e)
{if(!this._allowInlineFind)
return;if(new Date-this._lastKeyPress>1000)
this._accumulatedKeys="";this._accumulatedKeys+=String.fromCharCode(e.getKeyCode());var item=this._findItem(this._accumulatedKeys,null,"String");if(item)
{var oldVal=this._selectionModel._getChangeValue();var oldFireChange=this._selectionModel._fireChange;this._selectionModel._fireChange=false;this._selectionModel._deselectAll();this._selectionModel.setItemSelected(item,true);this._selectionModel.setAnchorItem(item);this._selectionModel.setLeadItem(item);item.scrollIntoView();this._selectionModel._fireChange=oldFireChange;if(this._selectionModel._fireChange&&this._selectionModel._hasChanged(oldVal))
this._selectionModel._dispatchChange();}
this._lastKeyPress=(new Date).valueOf();e.preventDefault();};function BiAbstractGridRow(){if(_biInPrototype)return;BiObject.call(this);}
_p=_biExtend(BiAbstractGridRow,BiObject,"BiAbstractGridRow");_p._grid=null;_p._icon=null;_p._selected=false;_p._anchor=false;_p._lead=false;BiAbstractGridRow.prototype.getBackColor=function(){return this._backColor;};BiAbstractGridRow.prototype.setBackColor=function(v){this._backColor=v;};BiAbstractGridRow.prototype.getForeColor=function(){return this._foreColor;};BiAbstractGridRow.prototype.setForeColor=function(v){this._foreColor=v;};_p._getStyle=function(){if(!this._backColor&&!this._foreColor)
return"";return" style=\""+(this._backColor?"background-color:"+this._backColor+";":"")+(this._foreColor?"color:"+this._foreColor+";":"")+"\"";};_p.setIcon=function(oIcon)
{if(oIcon==null||oIcon.getIconHtml||oIcon instanceof BiUri)
this._icon=oIcon;else this._icon=new BiUri(application.getAdfPath(),oIcon);};_p.getIcon=function()
{if(this._icon)
return this._icon;return application.getThemeManager().getDefaultTheme()
.getAppearanceProperty("grid","default-icon")||"";}
BiAbstractGridRow.prototype.getSelected=function(){return this._selected;};_p.setSelected=function(bSelected){if(this._selected!=bSelected){var g=this.getGrid();if(g!=null){g._selectionModel.setItemSelected(this,bSelected);}
this._setSelected(bSelected);}};_p._setSelected=function(bSelected){this._selected=bSelected;this._updateClassName();};_p._setAnchor=function(bAnchor){this._anchor=bAnchor;this._updateClassName();};_p._setLead=function(bLead){this._lead=bLead;this._updateClassName();};_p.getCreated=function(){var t=this.getGrid();if(!t||!t._gridCreated)return false;this._element=t._getGridElement(this);return this._element!=null;};_p._updateClassName=function(){if(!this.getCreated())return;this._element.firstChild.className=this.getCssClassName();};_p.update=function(){var g=this.getGrid()
if(!this.getCreated()||!g)return;if(BiBrowserCheck.ie)
this._element.outerHTML=this.getHtml();else {var dummy=g._document.createElement("DIV");dummy.innerHTML=this.getHtml();this._element.parentNode.replaceChild(dummy.firstChild,this._element);}
g._clearCache();};_p.scrollIntoView=function(bTopLeft){this.scrollIntoViewY(bTopLeft);};_p.getHeight=function(){return this.getGrid().getRowHeight();};_p.getTop=function(){if(this.getCreated()){var grid=this.getGrid();if(BiBrowserCheck.ie)
{return this._element.getBoundingClientRect().top-grid.getClientTop()+grid.getScrollTop()-grid.getInsetTop();}
else {var sum=0;var p=this._element.parentNode;while(p.nodeType==1)
{sum+=p.scrollTop;p=p.parentNode;}
return grid._document.getBoxObjectFor(this._element).y-sum-grid.getClientTop()+grid.getScrollTop()-grid.getInsetTop();}}};_p.scrollIntoViewY=function(bTop){if(!this.getCreated()){return;}
var p=this.getGrid();if(!p)return;var t=this.getTop();var h=this.getHeight();var st=p.getScrollTop();var ch=p.getClientHeight();var fh=p._getFillerHeight();if(bTop)
p.setScrollTop(t-fh);else if(bTop==false)
p.setScrollTop(t+h-ch);else if(h>ch||t-fh<st)
{p.setScrollTop(t-fh);}
else if(t+h>st+ch)
{p.setScrollTop(t+h-ch);}};_p.matchesString=function(sText){return false;};_p.matchesStringExact=function(sText){return false;};_p.dispose=function()
{if(this._disposed)return;this._grid=null;this._icon=null;};function BiGridColumn(sName){if(_biInPrototype)return;BiObject.call(this);if(sName)this._name=sName;this._header=new this._gridHeaderConstructor(this._name);};_p=_biExtend(BiGridColumn,BiObject,"BiGridColumn");_p._gridHeaderConstructor=BiGridHeader;_p._name="Untitled";_p._width=200;_p._align="left";_p._indentColumn=false;_p._iconColumn=false;_p._orderIndex= -1;_p._columnIndex= -1;_p._grid=null;_p._sortType="string";_p._visible=true;BiGridColumn.prototype.getHeader=function(){return this._header;};BiGridColumn.prototype.getGrid=function(){return this._grid;};BiGridColumn.prototype.getOrderIndex=function(){return this._orderIndex;};BiGridColumn.prototype.getColumnIndex=function(){return this._columnIndex;};_p.getTree=function()
{return this._grid;};_p.setAlign=function(s){this._align=s;this._grid._columnAligns[this._columnIndex]=s;this._header.setAlign(s);};_p.getAlign=function(){return this._align||"left";};BiGridColumn.prototype.getName=function(){return this._name;};_p.setName=function(s){this._name=s;this._grid._columnNames[this._columnIndex]=s;this._header.setText(s);};BiGridColumn.prototype.getWidth=function(){return this._width;};_p.setWidth=function(n){this._width=n;this._grid._columnWidths[this._columnIndex]=n;};BiGridColumn.prototype.getIndentColumn=function(){return this._indentColumn;};_p.setIndentColumn=function(b){if(this._indentColumn!=b);{this._indentColumn=b;if(b)this._grid.setIndentColumn(this._columnIndex);}};BiGridColumn.prototype.getIconColumn=function(){return this._iconColumn;};_p.setIconColumn=function(b){if(this._iconColumn!=b);{this._iconColumn=b;if(b)this._grid.setIconColumn(this._columnIndex);}};BiGridColumn.prototype.getVisible=function(){return this._visible;};_p.setVisible=function(b)
{if(this._visible!=b)
{this._visible=b;this._header.setVisible(b);}};_p.dispose=function(){if(this._disposed)return;BiObject.prototype.dispose.call(this);this._header.dispose();this._header=null;this._grid=null;};BiGridColumn.prototype.getSortType=function(){return this._sortType;};_p.setSortType=function(sType){this._sortType=sType;};_p.getSortFunction=function(){var f;switch(this._sortType.toLowerCase()){case"string":f=BiGridColumn.stringCompare;break;case"caseinsensitivestring":f=BiGridColumn.caseInsensitiveStringCompare;break;case"number":f=BiGridColumn.numberCompare;break;case"date":f=BiGridColumn.dateCompare;break;default:f=BiGridColumn.lessThanCompare;}
var index=this._columnIndex;return function(r1,r2){return f(r1.getData(index),r2.getData(index));};};BiGridColumn.numberCompare=function(n1,n2){return n1-n2;};BiGridColumn.dateCompare=function(d1,d2)
{return BiGridColumn.numberCompare(d1,d2);};BiGridColumn.lessThanCompare=function(v1,v2){if(v1<v2)
return-1;if(v2<v1)
return 1;return 0;};BiGridColumn.stringCompare=function(s1,s2)
{return BiGridColumn.lessThanCompare(s1,s2);};BiGridColumn.caseInsensitiveStringCompare=function(s1,s2){return BiGridColumn.stringCompare(s1.toLowerCase(),s2.toLowerCase());};function BiTree(){if(_biInPrototype)return;BiAbstractGrid.call(this);this.setCssClassName("bi-tree");this.setAppearance("grid");this._selectionModel=new BiTreeSelectionModel(this);this._selectionModel.setMultipleSelection(false);this._headers=new this._gridHeadersConstructor;this.addEventListener("mousedown",this._onMouseEvent);this.addEventListener("mouseup",this._onMouseEvent);this.addEventListener("click",this._onMouseEvent);this.addEventListener("dblclick",this._onMouseEvent);this.addEventListener("keydown",this._onKeyDown);this.addEventListener("keypress",this._onKeyPress);this.addEventListener("focus",this._onFocusChange);this.addEventListener("blur",this._onFocusChange);this._selectionModel.addEventListener("change",function(e){this.dispatchEvent(new BiEvent("change"));},this);this.add(this._headers);this._headers.addEventListener("columnwidthschanged",this.updateColumns,this);this._headers.addEventListener("columnorderschanged",function(e){this.setColumnOrders(this._headers.getColumnOrders());this.updateColumns();this.updateData();},this);this._headers.addEventListener("sortcolumnchanged",function(e){this.sort(this._headers.getSortColumn(),this._headers.getAscending());},this);this._headers.addEventListener("ascendingchanged",function(e){this.sort(this._headers.getSortColumn(),this._headers.getAscending());},this);this.addEventListener("scroll",function(e){this._headers.setScrollLeft(this.getScrollLeft());});}
_p=_biExtend(BiTree,BiAbstractGrid,"BiTree");_p._indentColumn= -1;_p._indentWidth=19;_p._showLines=true;_p._showRootLines=false;_p._showPlusMinus=true;_p._parentNode=null;_p._rowHeight=18;BiTree.prototype.getIndentWidth=function(){return this._indentWidth;};BiTree.prototype.setIndentWidth=function(v){this._indentWidth=v;};BiTree.prototype.getShowPlusMinus=function(){return this._showPlusMinus;};BiTree.prototype.setShowPlusMinus=function(v){this._showPlusMinus=v;};BiTree.prototype.getShowRootLines=function(){return this._showRootLines;};BiTree.prototype.setShowRootLines=function(v){this._showRootLines=v;};_p._layoutHeaders=function(){this.updateHeadersWidth();};_p.addNode=function(oChild,oBefore){var p=oChild._parentNode;if(oBefore==null){if(p!=null)
p.removeNode(oChild);this._nodes.push(oChild);}
else{if(oBefore._parentNode!=this)
throw new Error("Can only add components before siblings");if(p!=null)
p.removeNode(oChild);this._nodes.insertBefore(oChild,oBefore);this._rows=this._nodes;}
oChild._parentNode=this;oChild._grid=this;oChild._level=1;this._clearCache();};_p.removeNode=function(oChild){if(oChild._parentNode!=this)
throw new Error("Can only remove children");this._nodes.remove(oChild);this._rows=this._nodes;oChild._parentNode=null;oChild._grid=null;this._clearCache();return oChild;};_p.getGrid=function(){return this;};_p.getTree=function(){return this;};_p.getLevel=function(){return-1;};_p.containsNode=function(oDescendant){if(oDescendant==null)return false;if(oDescendant==this)return true;var p=oDescendant._parentNode;return this.containsNode(p);};_p.getFirstNode=function(){return this._nodes[0];};_p.getLastNode=function(){return this._nodes[this._nodes.length-1];};BiTree.prototype.getNodes=function(){return this._nodes;};_p.hasNodes=function(){return this._nodes.length>0;};_p.isLeaf=function(){return!this.hasNodes();};_p.getNextSiblingNode=function(){return null;};_p.getPreviousSiblingNode=function(){return null;};_p.isLastSiblingNode=function(){return true;};_p.getParentNode=function(){return null;};_p.removeAll=function(){this._selectionModel.deselectAll();for(var i=this._nodes.length-1;i>=0;i--){var n=this._nodes[i];this.removeNode(n);n.dispose();}};BiTree.prototype.getIndentColumn=function(){return this._indentColumn;};_p.setIndentColumn=function(n){if(this._columns[this._indentColumn])
this._columns[this._indentColumn]._indentColumn=false;this._indentColumn=n;if(this._columns[this._indentColumn])
this._columns[this._indentColumn]._indentColumn=true;};BiTree.prototype.setShowLines=function(v){this._showLines=v;};_p.getShowLines=function(){return this._showLines&&this._indentColumn>=0&&this._indentColumn<this._columnCount;};_p._getStyleRules=function()
{var rs=[];var id=this.getHtmlProperty("id");var align,i;var widthSum=0;var cols=this._columns;for(i=0;i<this._columnCount;i++)
{if(!cols[i].getVisible())
{rs.push({selector:"#"+id+" .col-"+i,style:"display:none;"});}
else {align=this._columnAligns[i];rs.push({selector:"#"+id+" .col-"+i,style:"width:"+this._columnWidths[i]+"px"+(align!="left"?";text-align:"+align:"")});widthSum+=this._columnWidths[i];}}
if(this._indentColumn!= -1&&this._indentColumn<this._columnCount&&this._columns[this._indentColumn].getVisible())
{if(this._showPlusMinus||this._showLines)
rs.push({selector:"#"+id+" .col-"+this._indentColumn,style:"padding-left:0"});var indentColumnLeft=0;var visIndex=this._columns[this._indentColumn].getOrderIndex();for(i=0;i<this._columnCount;i++)
{if(this._columns[i].getVisible()&&this._columns[i].getOrderIndex()<visIndex)
indentColumnLeft+=this._columnWidths[i];}
var accumSelector="#"+id+" .bi-tree-children ";var accumPadding=this._indentWidth+(this._showPlusMinus||this._showLines?0:5);var d=this.getDepth();for(i=1;i<d;i++)
{rs.push({selector:accumSelector+".col-"+this._indentColumn,style:"padding-left:"+accumPadding+"px"});if(accumPadding-Math.ceil(this._indentWidth/2)>this._columnWidths[this._indentColumn])
break;rs.push({selector:accumSelector,style:"background-position:"+(accumPadding+indentColumnLeft-this._indentWidth)+"px 0"});accumPadding+=this._indentWidth;accumSelector+=".bi-tree-children ";}}
var val="height:"+this._rowHeight+"px;"+"line-height:"+(this._rowHeight-2)+"px;"+"font-size:"+this._fontSize+"px;";rs.push({selector:"#"+id+" .bi-tree-cell",style:val});rs.push({selector:"#"+id+" .bi-tree-row",style:val});rs.push({selector:"#"+id+" .bi-tree-row",style:"width:"+widthSum+"px;"});return rs;};_p.getDepth=function(){if(this._depth!=null)
return this._depth;var d=0;var cs=this._nodes;var l=cs.length;for(var i=0;i<l;i++)
d=Math.max(d,cs[i].getDepth()+1);return this._depth=d;};_p._findItem=function(oValue,nStartIndex,sType){var i;var items=BiTreeHelper.getPreorderShownNodes(this);if(nStartIndex==null){var si=this.getSelectedNode();nStartIndex=items.indexOf(si);if(nStartIndex== -1)
nStartIndex=0;}
var methodName="matches"+sType;for(i=nStartIndex;i<items.length;i++){if(items[i][methodName](oValue))
return items[i];}
for(i=0;i<nStartIndex;i++){if(items[i][methodName](oValue))
return items[i];}
return null;};_p._getMouseEventInfo=function(e,inEl){var el=inEl||e._event.srcElement||e._event.target;if(el==null)return null;var res={};res.expandIconClicked=el.tagName=="IMG"&&el.className=="bi-tree-expand-icon";var cellRe= /bi-tree-cell/;var cellEl=el;while(cellEl!=null&&!cellRe.test(cellEl.className))
cellEl=cellEl.parentNode;if(cellEl!=null){if(cellRe.test(cellEl.className)){res.cellIndex=Number(cellEl.className.replace(/.*col-(\d+).*/,"$1"));}
el=cellEl;}
else{res.cellIndex= -1;}
while(el!=null&&!/bi-tree-node/.test(el.className))
el=el.parentNode;if(el==null)return null;res.treeNode=this._getAllNodes()[el.id];return res;};_p._onMouseEvent=function(e){var info=this._getMouseEventInfo(e);if(info==null||info.treeNode==null)return;var node=info.treeNode;switch(e.getType()){case"mousedown":if(info.expandIconClicked&&node.hasNodes()){node.toggle();if(node.getExpanded())

⌨️ 快捷键说明

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