/* Product Name: dhtmlxSuite Version: 5.2.0 Edition: Professional License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com Copyright UAB Dinamenta http://www.dhtmlx.com */ /** * @desc: load grid from CSV file * @param: path - path to file * @param: afterCall - function which will be called after xml loading * @type: public * @edition: Professional * @topic: 0 */ dhtmlXGridObject.prototype.loadCSVFile = function(path,afterCall){ this.load(path,afterCall,"csv") } /** * @desc: enable mode, where ID for rows loaded from CSV autogenerated * @param: mode - true/false * @type: public * @edition: Professional * @topic: 0 */ dhtmlXGridObject.prototype.enableCSVAutoID = function(mode){ this._csvAID=dhx4.s2b(mode); } /** * @desc: enable recognizing first row in CSV as header * @param: mode - true/false * @type: public * @edition: Professional * @topic: 0 */ dhtmlXGridObject.prototype.enableCSVHeader = function(mode){ this._csvHdr=dhx4.s2b(mode); } /** * @desc: load grid from CSV string * @param: str - delimer used in CSV operations, comma by default ( only single char delimeters allowed ) * @type: public * @edition: Professional * @topic: 0 */ dhtmlXGridObject.prototype.setCSVDelimiter = function(str){ this.csv.cell=str; } dhtmlXGridObject.prototype._csvAID = true; /** * @desc: load grid from CSV string * @param: str - CSV string * @type: public * @edition: Professional * @topic: 0 */ dhtmlXGridObject.prototype.loadCSVString = function(str){ this.parse(str,"csv") } /** * @desc: serialize to CSV string * @type: public * @param: text only - force serialization of text values ( skip HTML elements ) ) * @edition: Professional * @topic: 0 */ dhtmlXGridObject.prototype.serializeToCSV = function(textmode){ this.editStop() if (this._mathSerialization) this._agetm="getMathValue"; else if (this._strictText || textmode) this._agetm="getTitle"; else this._agetm="getValue"; var out=[]; if (this._csvHdr){ for (var j=1; j < this.hdr.rows.length; j++) { var a=[]; for (var i=0; iind && start) start--; for(var jj=start;ind=end) break; } if (ind>=end) break; ind++; /* if (zx.getText) zxVal=zx.getText(); else*/ if (zx.cell) zxVal=zx[this._agetm](); else zxVal=""; if ((this._chAttr)&&(zx.wasChanged())) changeFl=true; out[out.length]=((zxVal===null)?"":zxVal) //#colspan:20092006{ if ( this._ecspn && cvx.colSpan && cvx.colSpan >1 ){ cvx=cvx.colSpan-1; for (var u=0; u0 && !out[last].length) out.splice(last,1); return out; }, str:function(data,cell,row){ for (var i=0; i < data.length; i++) data[i] = '"'+data[i].replace(this._quote, "\"\"")+'"'; return data.join(cell); } }; /** * @desc: add new row from clipboard * @type: public * @edition: Professional * @topic: 5 */ dhtmlXGridObject.prototype.addRowFromClipboard = function(){ var csv=this.fromClipBoard(); if (!csv) return; var z=this.csvParser.unblock(csv, this.csv.cell, this.csv.row); for (var i=0; i"; if (!this.parentGrid) html+=(before||""); html += ''; var row_length = Math.max(this.rowsBuffer.length,this.rowsCol.length); //paging and smartrendering var col_length = this._cCount; var width = this._printWidth(); html += ''; for (var i=0; i'+this.getHeaderCol(i)+''; i+=colspan-1; } html += ''; for (var i=2; i"; var cells=this.hdr.rows[i].childNodes; for (var j=0; j < cells.length; j++) if (!this._hrrar || !this._hrrar[cells[j]._cellIndex]){ html+=cells[j].outerHTML; } html+=""; } else html+=""+(this._fake?this._fake.hdr.rows[i].innerHTML:"")+this.hdr.rows[i].innerHTML+""; } for (var i=0; i]*>/gi,"")+''; continue; } if (this.rowsCol[i] && this.rowsCol[i].style.display=="none") continue; var row_id if (this.rowsCol[i]) row_id=this.rowsCol[i].idd; else if (this.rowsBuffer[i]) row_id=this.rowsBuffer[i].idd; else continue; //dyn loading for (var j=0; j'+(value===""?" ":value)+''; if (cspan) j+=cspan-1; } html += ''; if (this.rowsCol[i] && this.rowsCol[i]._expanded){ var sub=this.cells4(this.rowsCol[i]._expanded.ctrl); if (sub.getSubGrid) html += ''; else html += ''; } } if (this.ftr) for (var i=1; i"; html += '
'+sub.getSubGrid().printView()+'
'+this.rowsCol[i]._expanded.innerHTML+'
'; if (this.parentGrid) return html; html+=(after||""); var d = window.open('', '_blank'); d.document.write(html); d.document.write(""); d.document.close(); if (this._fake) { this._hrrar=st_hr; } } dhtmlXGridObject.prototype._printWidth=function(){ var width = []; var total_width = 0; for (var i=0; i