We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Excel export only filtered and/or sorted data of the grid

I'm trying to export data from the grid....both filtered and not filtered.
My controller and view files are in the attachment. First, when I try to export without filter I got this:



and when I filter the grid, the message is:



So, I't simple...I load the grid with some data (filter it in the grid) and I want to export it, without loading the data again.
Is there some example like that?

I'm using



Thanks!
B.

Attachment: B_acd36e3f.zip

7 Replies

BJ Bernard Jurlina April 25, 2019 09:46 PM UTC

I left only two columns in the grid and in the datasource and exporting is working when I don't set any filter in the grid.

But, if I set it like this



The error is



I'm using OnToolbarClick function to get the filtered data:



And to export it in the controller



Any idea?
Thanks!

Bernard.


VN Vignesh Natarajan Syncfusion Team April 26, 2019 02:04 PM UTC

Hi Bernard, 
 
Thanks for contacting Syncfusion Support. 
 
Issue:-1 #Without Filter:- System.IndexOutofRangeException:- 
 
From your screenshot we understand that you are facing issue while exporting the Grid without applying filter. We have prepared a sample as per your code example but we are unable to reproduce your reported problem at our end. Kindly refer the below the sample Link 
 
 
The reported issue may occur while defining the anchor tag in the format property of Column. We suggest you achieve your requirement using column template feature of ejGrid. You can also export the Grid with column template.    
Please refer to the documentation Link for template column and its exporting 
 
Column Template 
 
 
 
Column Template Exporting 
 
 
 
After following the above solution still facing the issue, please share us the following details. 
 
  1. StackTrace of the issue.
       2.    Stringified model of the Grid on server side while on Exporting as like below screenshot and copy it into clipboard. 
 
  1. If possible replicate the issue in the above sample and revert us back.
 
 
Issue#2:- With Filter:- System.Argument.NullException:- 
 
We are able to reproduce the reported problem at our end by preparing sample as per your screenshot. In your code example, you have handled filtered data separately on server end. By default Grid will be exported with filtered data when Grid is exported after filtering a column.So it is not necessary to handle the filtered data on server side externally. We suggest you to remove the filtered data externally(ignoreonExport). 
 
Please get back to us if you need further assistance. 
 
Regards, 
Vignesh Natarajan. 
 



BJ Bernard Jurlina April 28, 2019 02:46 PM UTC

Hi Vignesh!

I cannot get this IgnoreOnExport to work. Is there maybe a chance to make me some example with the grid which is bounded to the data with the ajax on button click and then to export the data to excel? Filtered and unfiltered?

Everything I try is not wotking to me. Where I have to put ignoreOnExport.splice if I'm setting the grid's datasource from ajax on button click?
In the grid I'm not using column templates...I have only two columns, int and string.

Thanks!
Bernard.


BJ Bernard Jurlina April 28, 2019 04:42 PM UTC