Skip to Content
0
Former Member
Nov 26, 2012 at 08:33 PM

Save ICommand or IGrid raw xml data On Client side

32 Views

Hi,

I want to extract the raw xml data from and iCommand or Igrid that executed and save it to a file on the client side.

I already have the code on how to save the file on the client side I just cant figure out how to get the icommand or grid raw xml data out ?

So here's the function to save the data to the client PC :


function exportData(FileNameToSave, Data) {


var TextData = Data;

var expIFrame;

var fileName = FileNameToSave + ".xml";

var docElem = window.document;

var iframe = docElem.createElement("iframe");

iframe.height = iframe.width = 0;

docElem.appendChild(iframe);

if (iframe.contentWindow) {

iframe = iframe.contentWindow;

}

else {

if (iframe.contentDocument && iframe.contentDocument.document) {

iframe = iframe.contentDocument.document;

}

else {

iframe = iframe.contentDocument;

}

}


iframe.document.open('text/xml', 'replace');

iframe.document.write(TextData);

iframe.document.close();

iframe.document.execCommand("SaveAs", null, fileName);


}

So now I want to use something like :

iCommand.executeCommand();

var xmlRaw = iCommand.showXMLDetail()

exportData("rawfile2Save",xmlRaw);

so instead of having the window popup it should actually load the xml into the variable and then have it saved to disk ....

any ideas ?

Thanks