Number of records after the search or filter

One of the requirement for us is to display the number of users found when the search is performed. 

The search is currently using an external text box and a few other check boxes to control what need to be found.
So there is a need to display custom text describing how the search is performed.

Is there a way I can customize the 'No records display' or N of N pages (n items found) Text ?

Or get the number of records that matches to the search ?
     I tried to see if grid.datasource.length will give me this count, but no luck

Also , is it possible to support multi word search to perform in a way that makes sense ?

For example: I have a grid with list of employees displayed  and there is a external search box that can take the search text as "name= 'John', profession = 'IT Director'"

I would like the grid to look for specific column with specific words. Instead of looking at every column that is defined in the search settings with all the words.


1 Reply

RS Rajapandiyan Settu Syncfusion Team August 3, 2021 05:40 PM UTC

Hi Gayithri,  
  
Thanks for contacting Syncfusion support. 

Query #1: One of the requirement for us is to display the number of users found when the search is performed.  

When you perform searching in EJ2 Grid, the actionComplete event will be triggered. In that event, you can get the total searched records count. Find the below code example for your reference. 



[index.js] 

 
var grid = new ej.grids.Grid({ 
  dataSource: data, 
  allowPaging: true, 
  toolbar: ['Search'], 
  columns: [ 
    ---- 
  ], 
  actionComplete: actionComplete 
}); 
grid.appendTo('#Grid'); 
 
function actionComplete(args) { 
  if (args.requestType == 'searching') { 
    // get the total records count after searching performed 
    var searchedRecords = this.pageSettings.totalRecordsCount; 
    alert(searchedRecords); 
  } 
} 
 



Query #2: Is there a way I can customize the 'No records display' or N of N pages (n items found) Text ? 

By using Globalization feature, you can customize the default text used in the Grid and Pager component. Please refer to the below documentation for more information. 


But before proceeding with this, please confirm us are you want to customize this text only after searching performed? 

Query #3: is it possible to support multi word search to perform in a way that makes sense ? 

By default, the EJ2 Grid search only one value at time in the Grid. Since this the default architecture of EJ2 Grid. 

Query #4: I would like the grid to look for specific column with specific words. Instead of looking at every column that is defined in the search settings with all the words. 

By using filtering feature of Grid, you can perform filtering on specific column. please refer to the below documentation for your reference. 


If you want to perform filtering on programmatic way, then you can achieve this by using filterByColumn method. 


Please get back to us if you need further assistance with this. 

Regards,  
Rajapandiyan S 


Loader.
Up arrow icon