ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: kshipra on April 15, 2017, 12:08:10 am
-
XML data map in excel enables users to export data in xml. I have to provide same data to users.
Currently I am using FileSaver.js for local export, but xml export is not working. Json is handled very nicely.
How can I get data transformed into xml format.
{
type: 'select',
label: 'Format: ',
attr: 'id="co_export_format"',
options: [{ xlsx: 'Excel', csv: 'Csv', htm: 'Html', json: 'Json',xml: 'Xml' }]
},
{
type: 'button',
label: "Export",
icon: 'ui-icon-arrowthickstop-1-s',
listener: function () {
var format = $("#co_export_format").val(),
blob = this.exportData({
format: format,
render: true,
nopqdata: true
});
if (typeof blob === "string") {
blob = new Blob([blob]);
}
saveAs(blob, "pqGrid." + format);
}
}
For example:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<data-set xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<record>
<LastName>Foo</LastName>
<FirstName>ABC</Sales>
<Country>UK</Country>
<Quarter>Qtr 3</Quarter>
</record>
<record>
<LastName>Johnson</LastName>
<FirstName>XYZ</Sales>
<Country>USA</Country>
<Quarter>Qtr 4</Quarter>
</record>
</data-set>
-
There is no method in pqgrid to export to xml.
Probably you could write your own code to export to xml by iterating through dataModel.data and build your xml data map.