GridComponent error when calling groupModule.expandAll() on an empty datasource

We're currently encountering an issue on the React GridComponent configured with groupSettings. Whenever the component receives an empty dataSource and groupModule.expandAll(). We found this issue while migrating from 27.1.50 to 30.2.4.


Take note that we didn't have this issue on v27.

Below is a snapshot of our configuration:

const applyGroupExpandCollapse = () => { if (gridRef.current?.groupModule) { if (expandAllGroups) { gridRef?.current?.groupModule.expandAll(); } else { gridRef?.current?.groupModule.collapseAll(); } } }; <GridComponentref={gridRef}height="100%"dataSource={filteredData}pageSettings={{ pageSize:100}}allowPaging={true}allowGrouping={true}allowSorting={true}allowFiltering={true}allowReordering={true}allowResizing={true}showColumnChooser={true}rowSelected={handleRowSelect}rowDeselected={handleRowDeselect}allowTextWrap={true}textWrapSettings={{ wrapMode:'Content' }}groupSettings={{ columns: ['typeCode'], showDropArea: false, captionTemplate: groupCaptionTemplate, disablePageWiseAggregates: true, }}filterSettings={{ type:'Menu' }}selectionSettings={{ type:'Multiple', persistSelection: true }} ><ColumnDirectivefield="typeCode"textAlign="Left"width="180"visible={false}showInColumnChooser={false}headerText='Problem Type' /></ColumnsDirective><Injectservices={[Group,Sort, Filter, Page, Toolbar, Selection, Resize, Reorder, ColumnChooser]} /></GridComponent>


3 Replies

RA Roberto Añonuevo December 19, 2025 06:03 AM UTC

Below is the error that we get:

Cannot read properties of undefined (reading 'isCaptionRow') TypeError: Cannot read properties of undefined (reading 'isCaptionRow') at Group2.expandCollapse (/node_modules/.vite/deps/chunk-S2KSHGQF.js?v=91d263b7:32963:49) at Group2.collapseAll (node_modules/.vite/deps/chunk-S2KSHGQF.js?v=91d263b7:32975:12) at applyGroupExpandCollapse (Screen.tsx?t=1766100568364:122:39) at GridComponent2.onActionComplete (Screen.tsx?t=1766100568364:100:5) at Observer2.notify (node_modules/.vite/deps/chunk-P3FVOJFM.js?v=91d263b7:1609:23)



SR Sivaranjani Rajasekaran Syncfusion Team December 19, 2025 06:36 PM UTC

Hi Roberto Añonuevo,

Greetings from Syncfusion support!

Thank you for sharing the details. Based on your information, we were able to reproduce the reported issue in both v28 and the latest version (v30^) The issue occurs when the dataSource is empty, and you initially group a column and then call the expandAll or collapseAll method, which results in a script error.

We have confirmed that the reported behavior is an issue from our side and logged it as “Script Error When Calling expandAll or collapseAll on Grouped Columns with Empty DataSource”. Thank you for taking the time to report this issue and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technical feasibility and Product Development Life Cycle ) and will include the defect fix in our upcoming patch release which will be rolled out on “January 06, 2026”. Until then we appreciate your patience.

 

You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through the below link,

 

Feedback: https://www.syncfusion.com/feedback/71943/script-error-when-calling-expandall-or-collapseall-on-grouped-columns-with-empty


Temporary Sample-Level Solution : 


To avoid the error until the official fix is released, please add a condition to check whether the grid has data before calling expandAll() or collapseAll(). Here’s the updated sample code:



Code Example : 

 const applyGroupExpandCollapse = () => {
    if (
      gridRef.current?.groupModule &&
      gridRef.current?.currentViewData.length
    ) {
      if (expandAllGroups) {
        gridRef?.current?.groupModule.expandAll();
      } else {
        gridRef?.current?.groupModule.collapseAll();
      }
    }
  };


 

Disclaimer: "Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization".


Regards,
Sivaranjani R


SR Sivaranjani Rajasekaran Syncfusion Team January 6, 2026 10:58 AM UTC

Hi Roberto Añonuevo,

We are glad to announce that, we have included the fix for the issue Script Error When Calling expandAll or collapseAll on Grouped Columns with Empty DataSource in our 32.1.22 release. So please upgrade to our latest version of the Syncfusion package to resolve the reported issue.

 

Root Cause: When the column is grouped initially, the groupExpandCollapse method is invoked. Since the grid has no rows, empty row data is passed, causing rowObj to become undefined, which leads to the script error.

 

Solution: Modify the if condition in the expandCollapse method to return immediately when the row object is empty. This prevents script errors when expandAll or collapseAll is called.

 

Sample: https://stackblitz.com/edit/react-9inqcwlu-7w5dqkyj?file=index.js


Feedback: https://www.syncfusion.com/feedback/71943/script-error-when-calling-expandall-or-collapseall-on-grouped-columns-with-empty

 

We thank you for your support and appreciate your patience in waiting for this release. Please get back to us if you need any further assistance.


Loader.
Up arrow icon