Childgrid get record count of child grid

what is the preferred method for getting the totoal record count of the expanded child grid.
as the grid.childgrid.pagesettings.totalrecordcount is undefined on databound event.

1 Reply

GL Gowri Loganathan Syncfusion Team April 7, 2020 11:08 AM UTC

Hi David, 
 
Thanks for contacting Syncfusion Forum. 
 
Query : Preferred method for getting the total record count of the expanded child grid. 
 
We have achieved your requirement using totalRecordsCount of pageSettings inside the dataBound event of childGrid. In the below sample we have displayed the expanded child grid count through alert message. Please refer to the below code snippet and sample link, 
 
Code snippet 
var child = { 
                               dataSource: window.gridData, 
                               queryString: "EmployeeID", 
                               dataBound: "dataBound", 
          . . . . . . } 
 
ReactDOM.render( 
<div id="Grid1"> 
   
  <EJ.Grid id="Grid1" dataSource={window.employeeView} allowPaging={true} allowSelection={true} pageSettings={pageSettings} allowGrouping={true} childGrid={child}> 
         . . . . . . .  
 
<script> 
                   function dataBound(args){ 
                             var childcount = this.model.pageSettings.totalRecordsCount// get the child grid record count here 
                               alert(childcount);           
                              } 
</script> 
 
 
If we have misunderstood your query, please get back to us with detailed explanation. 
 
Regards, 
Gowri V L 
 


Loader.
Up arrow icon