Interoperable interactive geometry for Europe
I forgot my login data
Register


Report a bug


Fan club

Quick Intro Videos
click to start movie
Create A Simple
GeoGebra Resource (25Mb)
click to start movie
Filing a review
click to start movie
Find a Resource

SPONSORS
This platform is brought to you by the intergeo project, funded under the eContent Plus programme of the European commission and by partners

var grids=[]; // table // ------------------------------------ extend extjs ------------------------------------ Ext.apply(Ext.grid.GridView.prototype,{ // remove red triangles doRender : function(cs, rs, ds, startRow, colCount, stripe){ var ts = this.templates, ct = ts.cell, rt = ts.row, last = colCount-1; var tstyle = 'width:'+this.getTotalWidth()+';'; var buf = [], cb, c, p = {}, rp = {tstyle: tstyle}, r; for(var j = 0, len = rs.length; j < len; j++){ r = rs[j]; cb = []; var rowIndex = (j+startRow); for(var i = 0; i < colCount; i++){ c = cs[i]; p.id = c.id; p.css = i == 0 ? 'x-grid3-cell-first ' : (i == last ? 'x-grid3-cell-last ' : ''); p.attr = p.cellAttr = ""; p.value = c.renderer(r.data[c.name], p, r, rowIndex, i, ds); p.style = c.style; if(p.value == undefined || p.value === "") p.value = " "; cb[cb.length] = ct.apply(p); } var alt = []; if(stripe && ((rowIndex+1) % 2 == 0)){ alt[0] = "x-grid3-row-alt"; } if(r.dirty){ alt[1] = " x-grid3-dirty-row"; } rp.cols = colCount; if(this.getRowClass){ alt[2] = this.getRowClass(r, rowIndex, rp, ds); } rp.alt = alt.join(" "); rp.cells = cb.join(""); buf[buf.length] = rt.apply(rp); } return buf.join(""); }, focusCell : function(row, col, hscroll){ row = Math.min(row, Math.max(0, this.getRows().length-1)); var xy = this.ensureVisible(row, col, hscroll); this.focusEl.setXY(xy||this.scroller.getXY()); if(Ext.isGecko){ // this.focusEl.focus(); }else{ // this.focusEl.focus.defer(1, this.focusEl); } }, // private layout : function(){ if(!this.mainBody){ return; // not rendered } var g = this.grid; var c = g.getGridEl(); var csize = c.getSize(true); var vw = csize.width; if(vw < 20 || csize.height < 20){ // display: none? return; } if(g.autoHeight){ this.scroller.dom.style.overflow = 'hidden'; }else{ this.el.setSize(csize.width, csize.height); var hdHeight = this.mainHd.getHeight(); var vh = csize.height - (hdHeight); this.scroller.setSize(vw, vh); if(this.innerHd){ this.innerHd.style.width = (vw)+'px'; } } if(this.forceFit){ if(this.lastViewWidth != vw){ this.fitColumns(false, false); this.lastViewWidth = vw; } }else{ this.autoExpand(); this.syncHeaderScroll(); } this.onLayout(vw, vh); } }); Ext.apply(Ext.grid.EditorGridPanel.prototype,{ // multi-lines wrapper and clear default value preEditValue : function(r, field){ var value = r.data[field]; if(!r.dirty||(r.dirty && typeof r.modified[field] == 'undefined')){ value=''; }else if(typeof value == 'string'){ value=value.replace(//gi,'\r\n'); value=this.autoEncode ? Ext.util.Format.htmlDecode(value) : value; } return value; }, postEditValue : function(value, originalValue, r, field){ if(typeof value == 'string'){ value=this.autoEncode ? Ext.util.Format.htmlEncode(value) : value; value=value.replace(/\r\n/gi,"
").replace(/\n/gi,'
'); } delete Ext.currentCellNode; return value; } }); Ext.apply(Ext.grid.GridEditor.prototype, { // set auto size autoSize: true, doAutoSize : function(){ if(this.autoSize){ var parentNode=this.boundEl.dom.parentNode; var width=parentNode.clientWidth; var height=parentNode.clientHeight; switch(this.autoSize){ case "width": this.setSize(width, ""); break; case "height": this.setSize("", height-1); break; default: this.setSize(width, height-1); } Ext.currentCellNode=parentNode; } } }); Ext.apply(Ext.form.TextArea.prototype, { // auto size cell onKeyUpBuffered : function(e){ if(!e.isNavKeyPress()||e.getKey()==e.ENTER){ this.autoSize(); } else if (e.isNavKeyPress()) { var index=this.gridIndex; if (grids[index].isJumpToNext) { grids[index].clickTabToNextNum = grids[index].clickTabToNextNum + 1; if (grids[index].clickTabToNextNum == 2) { grids[index].isJumpToNext = false; grids[index].clickTabToNextNum = 0; document.getElementById(grid_config[index].nextEl).focus(); } } else if (grids[index].isJumpToPre) { grids[index].clickTabToPreNum = grids[index].clickTabToPreNum + 1; if (grids[index].clickTabToPreNum == 2) { grids[index].isJumpToPre = false; grids[index].clickTabToPreNum = 0; document.getElementById(grid_config[index].preEl).focus(); } } } }, autoSize : function(){ if(!this.grow || !this.textSizeEl){ return; } var el = this.el; var v = el.dom.value; var ts = this.textSizeEl; ts.innerHTML = ''; ts.appendChild(document.createTextNode(v)); v = ts.innerHTML; Ext.fly(ts).setWidth(this.el.getWidth()); if(v.length < 1){ v = "  "; }else{ if(Ext.isIE){ v = v.replace(/\n/g, '

 

'); } v += this.growAppend; } ts.innerHTML = v; var h = Math.min(this.growMax, Math.max(ts.offsetHeight, this.growMin)+this.growPad); if(h != this.lastHeight){ if(Ext.currentCellNode){ if(h>Ext.currentCellNode.clientHeight){ this.lastHeight = h; this.el.setHeight(h); this.fireEvent("autosize", this, h); if(Ext.isIE){ Ext.currentCellNode.style.height=h; }else{ Ext.currentCellNode.setStyle('height:'+h+'px'); } } }else{ this.lastHeight = h; this.el.setHeight(h); this.fireEvent("autosize", this, h); } } } }); // ------------------------------------ edit grid definition ------------------------------------ function cellClick(obj, row, col, e){ var record = obj.store.getAt(row); var index=obj.store.gridIndex; var config=grid_config[index]; var column=config.columns[col]; if(row>=0&&row/gi,'\r\n'); str = Ext.util.Format.htmlDecode(str); str = formatString(str, /#/g, "#"); str = formatString(str, /1/g, "1"); str = formatString(str, /\*/g, "*"); str = formatString(str, /a/g, "a"); str = formatString(str, /A/g, "A"); str = formatString(str, /i/g, "i"); str = formatString(str, /I/g, "I"); str = formatString(str, /g/g, "g"); str = formatString(str, /h/g, "h"); str = formatString(str, /k/g, "k"); str = formatString(str, /_/g, "_"); str = formatString(str, /~/g, "~"); str = formatString(str, /-/g, "-"); str = formatString(str, /{/g, "{"); str = formatString(str, /}/g, "}"); str = formatString(str, /\(/g, "("); str = formatString(str, /\)/g, ")"); str = formatString(str, /\|/g, "|"); str = formatString(str, /\$/g, "$"); str = formatString(str, /@/g, "@"); str = formatString(str, /\[/g, "["); str = formatString(str, /\]/g, "]"); str = formatString(str, //g, ">"); str = str.replace(/\r\n/gi,"\\\\") return str; } function formatString(str, reg, repls){ return str.replace(reg, repls) } function getTableText(index){ var str = '\{table\}'; var config=grid_config[index]; var header=''; for(var i=0;i