To serialize dhtmlxGrid data into an XML string, use the serialize method:
var myXmlString = mygrid.serialize();
Related sample: Sample without title: dhtmlxGrid/samples/17_serialization/01_pro_serialize.html
Configuration methods and properties for XML serialization:
sets a custom name for row tags
mygrid.xml.s_row="myrowtag";
sets a custom name for cell tags
mygrid.xml.s_cell="mycelltag";
allows you to include custom row attributes to serialization
mygrid.setRowAttribute("row3","custom1","data");
...
mygrid.xml.row_attrs.push("custom1");
allows you to include custom cell attributes to serialization
mygrid.cells(i,j).setAttribute("custom2","data");
...
mygrid.xml.cell_attrs.push("custom2");
specifies whether you should:
mygrid.setSerializationLevel(true,false,true,false,true,true);
sets columns that will be included to serialization
mygrid.setSerializableColumns("true,false,false,true,false,false,false");
enables serialization formulas as mathematical expressions not data values
mygrid.enableMathSerialization(true);
Related sample: Sample without title: dhtmlxGrid/samples/17_serialization/01_pro_serialize.html
To serialize dhtmlxGrid data into a CSV string, use the serializeToCSV method:
var myCSVString = mygrid.serializeToCSV();
Related sample: Import/export from/to CSV
CSV serialization related methods:
sets the CSV delimeter. By default, ','(comma)
mygrid.setCSVDelimiter("\t");
allows you to autogenerate IDs for rows while loading a grid from a CSV string
mygrid.enableCSVAutoID(true);
'says' to recognize the first row in the CSV string as the header
mygrid.enableCSVAutoID(true);
'says' to include the serialized grid as a part of form submit policy
mygrid.submitSerialization(true);
Related sample: Import/export from/to CSV
Back to top