- Home
- Forum
- React - EJ 2
- How would i show loader/shimmer in the intial load of grid ?
How would i show loader/shimmer in the intial load of grid ?
Currently in my grid componetn for some reason for split seconds 'No records to display' then the loader is shown rather than showing the loader/shimmer from the start. How would i solve it
Hi ,
Greetings from Syncfusion Support,
We understand that you want to display a shimmer effect before the data is loaded the Grid component. To achieve this, use the dataBound event to conditionally invoke the showMaskRow() method. This will display the shimmer effect till the data is bound to the grid, and it will automatically be removed once the data is bound. Please refer to the below code snippet and sample for more information.
|
let initialRender
= true; if (initialRender) { gridRef.current.showMaskRow(); initialRender = false; } } |
Sample : https://stackblitz.com/edit/react-9zcfto2c?file=index.js
Please get back to us if you need further assistance
Regards,
Kishore Muthukrishnan
Thanks ,
This solved my problem but then i came accross another after usign this trick .
The grid table shrink for some time during the shimmer period if i use this mechansim i want no change in side the grid like it should stay same size . I think grid content shrinks for somreason. By shrink i mean that the height of the grid componnet dissapears only the header and the pagination part remaing with the grid content taking very minimal height
Hi ,
When you set the grid’s height to 100%, its height is determined by the content. If no records are loaded yet, the shimmer effect will only appear within the empty record area. To display the shimmer with a fixed height regardless of content, set a static height for the grid. Please refer to the below code snippet and sample for more information.
|
<GridComponent ref={gridRef} dataBound={dataBound} allowSorting={true} allowFiltering={true} height={'400'} filterSettings={filterSettings} loadingIndicator = {loadingIndicator}> |
Sample : https://stackblitz.com/edit/react-9zcfto2c-3omrfhgl?file=index.js,index.html
Regards,
Kishore Muthukrishnan
- 3 Replies
- 2 Participants
-
CC Ch Cv
- Dec 21, 2025 08:16 AM UTC
- Dec 24, 2025 09:47 AM UTC