Types in EJ2 TypeScript Spinner control
8 May 20233 minutes to read
By default, the Spinner is loaded in the applicable Essential JS 2 component based on the theme imported into the page. Based on the theme, the type is set to the Spinner.
The available types are:
- Material
- Fabric
- Bootstrap
You can change the Essential JS 2 component spinner type by passing the type of the spinner as parameter to the setSpinner
method like as below.
// Specify the type of the Spinner to be displayed
setSpinner({ type: 'Bootstrap'});
After Essential JS 2 component creation only, you can change the Essential JS 2 component spinner type.
import { createSpinner, setSpinner , showSpinner } from '@syncfusion/ej2-popups';
import { Grid } from '@syncfusion/ej2-grids';
import { data } from './datasource.ts';
let gridData: Object[] = data.slice(0, 7);
// By default, Spinner is rendered with specified theme inside the Grid component.
let grid: Grid = new Grid({
dataSource: gridData,
columns: [
{ field: 'OrderID', headerText: 'Order ID', textAlign: 'right', width: 120, type: 'number' },
{ field: 'CustomerID', width: 140, headerText: 'Customer ID', type: 'string' },
{ field: 'Freight', headerText: 'Freight', textAlign: 'right', width: 120, format: 'C' },
{ field: 'OrderDate', headerText: 'Order Date', width: 140, format: 'yMd' }
]
});
grid.appendTo('#Grid');
grid.hideSpinner = () => true;
// Specify the type of the Spinner to be displayed in the Grid.
setSpinner({ type: 'Bootstrap'});
<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Spinner</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="TypeScript NumericTextBox Component" />
<meta name="author" content="Syncfusion" />
<link href="styles.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/23.1.36/ej2-base/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/23.1.36/ej2-popups/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/23.1.36/ej2-navigations/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/23.1.36/ej2-grids/styles/material.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<h5> Grid is rendered with Bootstrap type Spinner </h5>
<div id="Grid" class="spinner-grid">
</div>
</div>
</body>
</html>