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

Grid Filtered Data Source


I am looking for a way to get the data of a grid after filtering has been applied, how can this be achieved?


1 Reply

TS Thavasianand Sankaranarayanan Syncfusion Team March 4, 2019 11:52 AM UTC

Hi Rikard, 

Greetings from Syncfusion. 

Based on your query we suspect that you want to get the filtered record from. So, we suggest you to use the below code example.    

In the below code example we have get the filtered record by clicking the external button. 


<ejs-button id="clickbutton" content="getFilteredData"></ejs-button> 
<ejs-grid id="Grid" dataSource="ViewBag.dataSource" allowPaging="true" allowFiltering="true"> 
    <e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true"></e-grid-editSettings> 
        <e-grid-column field="OrderID" headerText="Order ID" isPrimaryKey="true" textAlign="Right" width="100"></e-grid-column> 
        <e-grid-column field="CustomerID" headerText="Customer ID" width="100"></e-grid-column> 
        <e-grid-column field="EmployeeID" headerText="Employee ID" width="100"></e-grid-column> 
        <e-grid-column field="Freight" width="100"></e-grid-column> 
        <e-grid-column field="Verified" headerText="Verified" width="100"></e-grid-column> 
    document.getElementById('clickbutton').addEventListener('click', function (e) { 
        var f_data; 
        var grid = document.getElementById('Grid').ej2_instances[0]; 
        var query = grid.renderModule.data.generateQuery(); // get grid corresponding query  
        for (var i = 0; i < query.queries.length; i++) { 
            if (query.queries[i].fn == 'onPage') { 
                query.queries.splice(i, 1);       // remove page query to get all records  
        var dm = new ej.data.DataManager(grid.dataSource) 
        f_data = dm.executeLocal(query); 

Please let us know if you need further assistance on this. 

Thavasianand S. 

Live Chat Icon For mobile
Up arrow icon