Ask Your Question
0

How can I display a loading message in aggrid using react js?

asked 2021-09-17 11:00:00 +0000

david gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2021-04-19 02:00:00 +0000

pufferfish gravatar image

You can display a loading message in ag-grid using React by setting the loadingOverlayComponent property in the gridOptions object.

First, create a custom component for the loading overlay. For example:

import React from 'react';

const LoadingOverlay = () => {
  return (
    <div className="ag-overlay-loading-wrapper">
      <div className="ag-overlay-loading-center">
        <i className="fas fa-spinner fa-spin"></i>
        <span>Loading...</span>
      </div>
    </div>
  );
};

export default LoadingOverlay;

Then, in your ag-grid React component, set the loadingOverlayComponent property in the gridOptions object to your custom component:

import { AgGridReact } from 'ag-grid-react';
import LoadingOverlay from './LoadingOverlay';

const MyGrid = () => {
  const gridOptions = {
    // ...
    loadingOverlayComponent: LoadingOverlay,
    // ...
  };

  // ...

  return (
    <div className="ag-theme-alpine">
      <AgGridReact
        {...gridOptions}
        // ...
      />
    </div>
  );
};

This will display your custom loading overlay component whenever the ag-grid component is loading data.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-09-17 11:00:00 +0000

Seen: 11 times

Last updated: Apr 19 '21