React TreeList - Load Panel
The load panel is displayed while the UI component loads data. It consists of a loading indicator and text, both placed on a pane.
The load panel is shown only for remote data sources by default. To show it regardless of the data source type, assign true to the loadPanel.enabled property. Setting the same property to false disables the load panel completely.
- import React from 'react';
- import 'devextreme/dist/css/dx.light.css';
- import TreeList, {
- LoadPanel
- } from 'devextreme-react/tree-list';
- export default function App() {
- return (
- <TreeList ... >
- <LoadPanel enabled />
- </TreeList>
- );
- }
You can also control the load panel programmatically using the beginCustomLoading(messageText) and endCustomLoading() methods.
- import React, { useRef, useCallback } from 'react';
- import 'devextreme/dist/css/dx.light.css';
- import TreeList, {
- // ...
- } from 'devextreme-react/tree-list';
- export default function App() {
- const treeList = useRef(null);
- const performLongOperation = useCallback(() => {
- treeList.current.instance.beginCustomLoading();
- // ...
- treeList.current.instance.endCustomLoading();
- }, []);
- return (
- <TreeList ref="treeList">
- {/* ... */}
- </TreeList>
- );
- }
Since the load panel is a DevExtreme LoadPanel UI component, you can declare any properties of this UI component in the TreeList's loadPanel object. For example, you can change the panel's size with the height and width properties, or employ another loading indicator using the indicatorSrc property.
- import React from 'react';
- import 'devextreme/dist/css/dx.light.css';
- import TreeList, {
- LoadPanel
- } from 'devextreme-react/tree-list';
- export default function App() {
- return (
- <TreeList ... >
- <LoadPanel
- height={100}
- width={250}
- indicatorSrc="https://js.devexpress.com/Content/data/loadingIcons/rolling.svg"
- />
- </TreeList>
- );
- }
See Also
If you have technical questions, please create a support ticket in the DevExpress Support Center.