PDA

View Full Version : Export Extjs/ Grid Filter to Excel:



Angelgab82
19 Feb 2009, 8:08 AM
First I would like to thank ambience who created the Grid Filter plug-in (wonderful job) and Animal for the great export to excel plug-in.

At my job I was required to create a Grid-Filter that exports Excel based on the filter, after making a research I reached a point that I could achieve it.

The example shows the Grid Filter (with php), I added the page exportxml.php which exports the filtered results into Excel and I added the folder (App_data) inside it the config.php file and class.mysql.php with checkurl.php.

The export is done from the mysql query not from the Javascript.

I’m new in php not much familiar most probably you will find the code not clean but I hope I can help others to achieve better coding.

In the excel if your using easy php on windows there is two declaration errors but in case of Linux no such errors.

Tested on IE8, FF, Chrome, Safari.


Best Regards,
Gabriel

BitPoet
19 Feb 2009, 8:33 AM
You should really use mysql_*escape functions on all input values in php instead of doing error-prone blacklisting of selected SQL terms - especially seeing that you are filtering REQUEST_URI while taking your values $_REQUEST instead of $_GET, which makes it easy for a possible attacker to circumvent your filter by submitting bad values via POST.

Angelgab82
20 Feb 2009, 12:07 AM
You should really use mysql_*escape functions on all input values in php instead of doing error-prone blacklisting of selected SQL terms - especially seeing that you are filtering REQUEST_URI while taking your values $_REQUEST instead of $_GET, which makes it easy for a possible attacker to circumvent your filter by submitting bad values via POST.

Thanks Bit for your help and advice, I didn't give the security much of time because this script is running intranet my idea was printing out from the mysql itself after filtering the grid.

Best regards,
Gabriel

anjelika
7 Mar 2009, 12:32 PM
Hi,
Works nice on filters but how do you export to excel?
Couldn't find any button for that.
Thanks

Angelgab82
8 Mar 2009, 2:06 AM
Hi,
Works nice on filters but how do you export to excel?
Couldn't find any button for that.
Thanks

In the example its already added.

In the file grid-filter.js:


var grid = new Ext.grid.GridPanel({
id: 'example',
title: 'Grid Filters Example',
ds: ds,
cm: cm,
enableColLock: false,
loadMask: true,
plugins: filters,
height:400,
width: 700,
el: 'grid-example',
autoExpandColumn: 'company',
bbar: new Ext.PagingToolbar({
store: ds,
pageSize: 15,
plugins: filters,
buttons: [{
id: 'grid-excel-button',
text: 'Export to Excel...',
handler: function(){
document.location = 'exportxml.php';
}
}]
})
});
grid.render();

anjelika
8 Mar 2009, 11:16 AM
OK found it, thanks.
I was unzipping the content to the wrong ext folder:P
Is there a way to customize the excel headers (add some color, width, etc..)?
Thanks

petrabudikarunia
20 Feb 2011, 11:26 AM
Hi, I have tried that.. the grid appears, but there is no record at all..

Surinder singh
11 Mar 2011, 3:46 PM
Hi,

here is another approach

http://www.developerextensions.com/index.php?option=com_extensiondemo&view=extensiondemo&layout=ext&extension=Ext-CopyPasteGrid_1.4&Itemid=480

vineetmangal
6 Oct 2011, 6:36 AM
Hi Angelga,

Thanks for your Efforts for this kinda of brilliant development. I tested this in Extjs 3.2.1 and IE8, Chrome 9.0 and FF7.0..but this is functioning in FF only.Can you please help me to come out of this problem so that i can use this in my project.

Thanks in Advance.​