Angular DataGrid - 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.
jQuery
$(function() { $("#dataGridContainer").dxDataGrid({ loadPanel: { enabled: true } }); });
Angular
<dx-data-grid ... > <dxo-load-panel [enabled]="true"> </dxo-load-panel> </dx-data-grid>
import { DxDataGridModule } from "devextreme-angular"; // ... export class AppComponent { // ... } @NgModule({ imports: [ // ... DxDataGridModule ], // ... })
Vue
<template> <DxDataGrid ... > <DxLoadPanel :enabled="true" /> </DxDataGrid> </template> <script> import 'devextreme/dist/css/dx.light.css'; import DxDataGrid, { DxLoadPanel } from 'devextreme-vue/data-grid'; export default { components: { DxDataGrid, DxLoadPanel }, // ... } </script>
React
import React from 'react'; import 'devextreme/dist/css/dx.light.css'; import DataGrid, { LoadPanel } from 'devextreme-react/data-grid'; export default function App() { return ( <DataGrid ... > <LoadPanel enabled /> </DataGrid> ); }
You can also control the load panel programmatically using the beginCustomLoading(messageText) and endCustomLoading() methods.
jQuery
var dataGrid = $("#dataGridContainer").dxDataGrid("instance"); dataGrid.beginCustomLoading(); // ... dataGrid.endCustomLoading();
Angular
import { ..., ViewChild } from "@angular/core"; import { DxDataGridModule, DxDataGridComponent } from "devextreme-angular"; // ... export class AppComponent { @ViewChild(DxDataGridComponent, { static: false }) dataGrid: DxDataGridComponent; // Prior to Angular 8 // @ViewChild(DxDataGridComponent) dataGrid: DxDataGridComponent; performLongOperation() { this.dataGrid.instance.beginCustomLoading(); // ... this.dataGrid.instance.endCustomLoading(); } } @NgModule({ imports: [ // ... DxDataGridModule ], // ... })
Vue
<template> <DxDataGrid ref="dataGridRefKey"> <!-- ... --> </DxDataGrid> </template> <script> import 'devextreme/dist/css/dx.light.css'; import DxDataGrid, { // ... } from 'devextreme-vue/data-grid'; const dataGridRefKey = "my-data-grid"; export default { components: { DxDataGrid, // ... }, data: function() { return { dataGridRefKey }; }, methods: { performLongOperation: function() { this.dataGrid.beginCustomLoading(); // ... this.dataGrid.endCustomLoading(); } }, computed: { dataGrid: function() { return this.$refs[dataGridRefKey].instance; } } } </script>
React
import React, { useRef, useCallback } from 'react'; import 'devextreme/dist/css/dx.light.css'; import DataGrid, { // ... } from 'devextreme-react/data-grid'; export default function App() { const dataGrid = useRef(null); const performLongOperation = useCallback(() => { dataGrid.current.instance().beginCustomLoading(); // ... dataGrid.current.instance().endCustomLoading(); }, []); return ( <DataGrid ref="dataGrid"> {/* ... */} </DataGrid> ); }
Since the load panel is a DevExtreme LoadPanel UI component, you can declare any properties of this UI component in the DataGrid'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.
jQuery
$(function() { $("#dataGridContainer").dxDataGrid({ loadPanel: { height: 100, width: 250, indicatorSrc: "https://js.devexpress.com/Content/data/loadingIcons/rolling.svg" } }); });
Angular
<dx-data-grid ... > <dxo-load-panel [height]="100" [width]="250" indicatorSrc="https://js.devexpress.com/Content/data/loadingIcons/rolling.svg"> </dxo-load-panel> </dx-data-grid>
import { DxDataGridModule } from "devextreme-angular"; // ... export class AppComponent { // ... } @NgModule({ imports: [ // ... DxDataGridModule ], // ... })
Vue
<template> <DxDataGrid ... > <DxLoadPanel :height="100" :width="250" indicator-src="https://js.devexpress.com/Content/data/loadingIcons/rolling.svg" /> </DxDataGrid> </template> <script> import 'devextreme/dist/css/dx.light.css'; import DxDataGrid, { DxLoadPanel } from 'devextreme-vue/data-grid'; export default { components: { DxDataGrid, DxLoadPanel }, // ... } </script>
React
import React from 'react'; import 'devextreme/dist/css/dx.light.css'; import DataGrid, { LoadPanel } from 'devextreme-react/data-grid'; export default function App() { return ( <DataGrid ... > <LoadPanel height={100} width={250} indicatorSrc="https://js.devexpress.com/Content/data/loadingIcons/rolling.svg" /> </DataGrid> ); }
See Also
If you have technical questions, please create a support ticket in the DevExpress Support Center.