How to export grid data to a string with Standard Edition?

Please bear with me as I’m completely new to this.

I downloaded the Standard Edition of dhtmlxGrid 3.5 today. On the editions comparison page (http://dhtmlx.com/docs/products/dhtmlxGrid/editions.shtml) it says that you can serialize to CSV in standard edition. In the documentation files included with the download it says to use the serializeToCSV() function, but whenever I call that function it breaks.

When I started searching for help I found in the online documentation that serializeToCSV() is only available in the professional edition which seems to contradict the edition comparison page (http://docs.dhtmlx.com/doku.php?id=dhtmlxgrid:api_method_dhtmlxgridobject_serializetocsv).

So I’m now curious how one can go about saving the data if both the serialize() and serializeToCSV() functions are only available to the professional edition. Is there some other function that I could use to dump the grid data back to a javascript variable as a string?

Any help that you can provide would be greatly appreciated. :slight_smile:

Here is the test page I’m working with:

[code]

TEST
<script src="codebase/dhtmlxcommon.js"></script>
<script src="codebase/dhtmlxgrid.js"></script>
<script src="codebase/dhtmlxgridcell.js"></script>
<script>
	var mygrid;
	var csvstr="a,11,12,13,14,15\nb,21,22,23,24,25\nc,31,32,33,34,35";
	function doInitGrid(){
		mygrid = new dhtmlXGridObject('mygrid_container');
		mygrid.setImagePath('./codebase/imgs/');
		mygrid.setHeader(["Col 1","Col 2","Col 3","Col 4","Col 5"], null, ["","","text-align:center","text-align:center",""]);
		mygrid.setColTypes("edtxt,edtxt,edtxt,edtxt,edtxt");
		mygrid.setColAlign('left,left,center,center,left');
		mygrid.setColSorting('str,str,str,str,str');
		mygrid.setSkin("dhx_skyblue");
		mygrid.attachEvent("onEditCell",doOnEditCell);
		mygrid.attachEvent("onGridReconstructed", doOnGridReconstruction);
		mygrid.init();
		mygrid.parse(csvstr,"csv");
	}
	function addRow(){
		var newId = (new Date()).valueOf();
		mygrid.addRow(newId,"",mygrid.getRowsNum());
		mygrid.selectRow(mygrid.getRowIndex(newId),false,false,true);
	}
	function removeRow(){
		var selId = mygrid.getSelectedId();
		mygrid.deleteRow(selId);
	}
	function doOnEditCell(stage,rId,cInd,nValue,oValue){
		if (stage == 2 && nValue != oValue) {
			updateOutput();
		}
	}
	function doOnGridReconstruction(grid_obj) {
		updateOutput();
	}
	function updateOutput() {
		alert("start");  // <------ THIS ALWAYS FIRES AS EXPECTED.
		csvstr = mygrid.serializeToCSV();
		alert("finish");  // <------ THIS NEVER FIRES.
		document.getElementById('output').innerHTML = csvstr;
	}
</script>
Add Row Remove Row
[/code]

Ugh…I feel stupid.

Added the line below and now it works.

<script src="codebase/ext/dhtmlxgrid_nxml.js"></script>