PDA

View Full Version : Exporting data from grid to excel sheet



prasad508211
12 May 2010, 3:25 AM
Hi,
I want to export data from grid to excel sheet on button click. I have tried the following code:


bbar: new Ext.Toolbar({
displayInfo: true,
height:20,
buttons: [linkButton]

})



linkButton.getEl().child('a', true).href = 'data:application/vnd.ms-excel;base64,' +

Base64.encode(mobileMonitorPanel.getExcelXml());


function exportExcel(){
var linkButton = new Ext.LinkButton({
id: 'grid-excel-button',
text: 'Export to Excel'

})
}



In the above code, I am getting error saying "Object expected". I am not getting the exact reason why that error is occuring. Please help. If you have any solution, please suggest.
Thanks.

jtpacheco
12 May 2010, 6:54 AM
First of all, for future reference please post your code in CODE tags.

Secondly, where does the error occur? Upon loading the page, or upon clicking the button?

Animal
12 May 2010, 7:23 AM
And does the browser support data URLs? This issue is mentioned in the thread.

jtpacheco
12 May 2010, 7:25 AM
I have no experience with it, but I'd imagine the browser itself would pop up an alert saying it doesn't know how to handle the "data:" protocol...Is this correct?

prasad508211
13 May 2010, 12:38 AM
It is IE 8. I dnt know whether it supports data URL. Can you please explain what it is

Animal
13 May 2010, 12:42 AM
http://www.google.co.uk/search?aq=f&sourceid=chrome&ie=UTF-8&q=data+url