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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid with virtualization get filtered Data

Thread ID:

Created:

Updated:

Platform:

Replies:

145976 Jul 16,2019 01:14 PM UTC Jul 18,2019 10:49 AM UTC JavaScript - EJ 2 3
loading
Tags: Grid
BERNARD Ludovic
Asked On July 16, 2019 01:14 PM UTC

Hello,

I am currently working with javascript (ES5 v.17.1.49) and I have a Grid with  "enableVirtualization" set to true.
When I filter the data and try to export it I only have access to :
  • dataSource
  • getSelectedRowIndexes()
  • currentViewData
But the currentViewData has only what is display on screen and not the whole data filtered (ex: 70 records before filter, 55 after filter, and 42 inside the currentViewData);

How can I get the list of filteredData record so I can export/work with it?


Thank you,

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On July 17, 2019 11:47 AM UTC

Hi Bernard, 

Thanks for contacting Syncfusion support. 

By default, Grid will export the given dataSource even after filtering several columns or doing anyother actions. But in the toolbarClick event, we can generate a query and execute them on the Grid dataSource. Later, the result will be given to the pdfExport method as the Export Properties. Refer to the following code example.  

<script> 
 
    var grid = new ej.grids.Grid({ 
        dataSource: orderData, 
        allowFiltering: true, 
        allowPdfExport: true, 
        filterSettings: { type: 'Excel' }, 
        toolbar: ['PdfExport'], 
        toolbarClick: function (args) { 
            if (args.item.text === 'PDF Export') { 
                let query = grid.renderModule.data.generateQuery(true); // get grid corresponding query 
                grid.getDataModule().executeQuery(query).then((e) => { 
                    console.log(e.result); 
                    grid.pdfExport({ dataSource: e.result });  //Export the filtered data. 
                }).catch((e) => { 
                    console.log(e); 
                }) 
            } 
        }, 
        enableVirtualization: true, 
        height: 400, 
         . . .  
            . . . 
    }); 
    grid.appendTo('#Grid'); 
 
</script> 



Note: If Grid in filtered state only you will get the filtered data while export. Otherwise you will get the entire dataSource in the result. 

Please get back to us, if you need further assistance. 

Regards, 
Seeni Sakthi Kumar S. 


BERNARD Ludovic
Replied On July 18, 2019 08:53 AM UTC

Thank you I works that way.

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On July 18, 2019 10:49 AM UTC

Hi Bernard, 

Thanks for the update.  

We are happy to hear that your requirement has been resolved. Please get back to us, if you require further assistance on this.  

Regards,  
Seeni Sakthi Kumar S. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon