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

How to get current query in Angular Grid

Hi,
is this method (Grid.getQuery()) not supposed to get current query from the grid?
it doesnt seem to be working (see picture below).
and this leads me to ask the question of it is somehow possible to get the current query (where\sort) from the grid?
thanks for your support in advance
regards
viktor



1 Reply

TS Thavasianand Sankaranarayanan Syncfusion Team September 12, 2019 10:58 AM UTC

Hi Viktor, 
 
Greetings from Syncfusion. 
 
Query: is this method (Grid.getQuery()) not supposed to get current query from the grid? 
 
We have validated your query and by default we have Query property in our grid. It is used to pass some additional parameters to grid. You can this type of details in grid.getQuery() method. 
 
Query: this leads me to ask the question of it is somehow possible to get the current query (where\sort) from the grid? 
 
You can get the current query of the grid by using generateQuery method. Here, we have getting current grid queries by using button click. Please find the below code snippets and sample for your reference. 
 
[code snippets] 
<div class="control-section"> 
  <button id='show' ejs-button class='e-flat' (click)='show()'> Get Current grid query </button> 
       <ejs-grid #grid [dataSource]='data' allowPaging='true' allowSorting="true" allowFiltering="true" [allowGrouping]="true" [groupSettings]="groupOptions" [pageSettings]='pageSettings' 
        height="320" (dataBound)='dataBound()' [query]='query'> 
        <e-columns> 
            ... 
       </e-columns> 
    </ejs-grid> 
</div> 
... 
export class AppComponent { 
    public data: Object[]; 
   ... 
    show() { 
        console.log(this.grid.getDataModule().generateQuery()); 
    } 
} 
 
 
Please get back to us if you need further assistance. 
 
Regards, 
Thavasianand S. 


Loader.
Live Chat Icon For mobile
Up arrow icon