To obtain the number of rows currently displayed on the grid.

The number of rows currently displayed in the grid is displayed on the screen.

What event should I use to get the number of rows in CurrentViewData at all times when the number of rows displayed in the grid changes, such as when the grid datasource is changed, when the toolbar's search function is used to narrow down the search, or when a new row is added using the toolbar's add button? What event should I use to get the number of rows in the CurrentViewData?


If the ActionComplete event is triggered, the ActionComplete event can be used to retrieve the CurrentViewData when the grid datasource is changed or when the toolbar's search function is used to narrow down the search.

              However, the problem is that when adding a new row from the toolbar's add button,        

              the ActionComplete event is not triggered, thus defeating the purpose.


1 Reply

DM Dineshnarasimman Muthu Syncfusion Team October 31, 2024 05:41 PM UTC

Hi Keita Okamura,


Greetings from Syncfusion Support.


Upon reviewing your query, we understand that you are looking to retrieve the currentViewData of the grid upon changing the dataSource and conducting a search operation within the grid. Additionally, you noted that when adding new rows to the grid via the toolbar's Add button, the actionComplete event is not triggered in your application. However, we attempted to replicate this issue on our end and were unable to reproduce it.


Here are a few suggestions depending on the edit mode being used:


When using Inline Edit:
 

function actionComplete(args) {

  var grid = document.getElementById('Grid').ej2_instances[0];

  console.log(grid.currentViewData);

  console.log(grid.getCurrentViewRecords())

}



When using Batch Edit:


function cellEdit(args)

{

  var grid = document.getElementById('Grid').ej2_instances[0];

  console.log(grid.currentViewData);

  console.log(grid.getCurrentViewRecords())

}


API: https://help.syncfusion.com/cr/aspnetcore-js2/syncfusion.ej2.grids.grid.html#Syncfusion_EJ2_Grids_Grid_CellEdit


Please provide the following information to validate it further.


  • Ensure us the type of editing you have used in your application.


  • Ensure us when you expect to retrieve the data, whether upon clicking the "Add" button or when updating the new record to the grid.


  • Provide us the video demonstration of the issue you are facing.


  • Please provide the grid rendering code information, which will help us to validate further.


We highly appreciate your co-operation in providing these details.


Regards,

Dineshnarasimman M


Attachment: CoreGridApp_a24cb979.zip

Loader.
Up arrow icon