Toolbar in Typescript Data Grid

The toolbar in the TypeScript Grid control offers several general use cases to enhance data manipulation and overall experience. Actions such as adding, editing, and deleting records within the grid can be performed, providing efficient data manipulation capabilities. The toolbar also facilitates data export and import functionality, allowing you to generate downloadable files in formats like Excel, CSV, or PDF.

To enable the toolbar functionality, you need to inject the Toolbar module in the grid. This module provides the necessary methods to interact with the toolbar items. The toolbar can be customized with built-in toolbar items or custom toolbar items using the toolbar property. The toolbar property accepts an array of strings representing the built-in toolbar items or an array of ItemModel objects for custom toolbar items.

The following example demonstrates how to enable toolbar items in the grid.

Enable or disable toolbar items

Enabling or disabling toolbar items dynamically in TypeScript Grid is to provide control over the availability of specific functionality based on application logic. This feature allows you to customize the toolbar based on various conditions or individuals interactions.

You can enable or disable toolbar items dynamically by using the enableToolbarItems method. This method allows you to control the availability of specific toolbar items based on your application logic.

Add toolbar at the bottom of Grid

By adding the toolbar at the bottom of the TypeScript Grid, important actions and functionality remain consistently visible and easily accessible, providing easy access to actions and operations without the need for scrolling.

To add the toolbar at the bottom of the Grid, you can utilize the created event. By handling this event, you can dynamically insert the toolbar items at the desired position in the grid layout.

The following example shows how to add the toolbar items at the bottom using created event of the grid.

Customize toolbar buttons using CSS

Customizing toolbar buttons in TypeScript Grid using CSS involves modifying the appearance of built-in toolbar buttons by applying CSS styles. This provides a flexible and customizable way to enhance the visual presentation of the toolbar and create a cohesive interface.

The appearance of the built-in toolbar buttons can be modified by applying the following CSS styles.

.e-grid .e-toolbar .e-tbar-btn .e-icons,
.e-grid .e-toolbar .e-toolbar-items .e-toolbar-item .e-tbar-btn {
    background: #add8e6;   
}

The following example demonstrates how to change the background color of the Add, Edit, Delete, Update and Cancel toolbar buttons by applying CSS styles.

See Also