Interface for a class TreeGrid
EmitType<PageEventArgs|FilterEventArgs|SortEventArgs|SearchEventArgs|AddEventArgs|SaveEventArgs|EditEventArgs|DeleteEventArgs>
Triggers when TreeGrid actions like sorting, filtering, paging, etc., start.
EmitType<PageEventArgs|FilterEventArgs|SortEventArgs|SearchEventArgs|AddEventArgs|SaveEventArgs|EditEventArgs|DeleteEventArgs>
Triggers when TreeGrid actions like sorting, filtering, paging, etc., are completed.
EmitType<FailureEventArgs>
Triggers when any TreeGrid action fails to achieve the desired results.
EmitType<BatchAddArgs>
Triggers when records are added in batch mode.
EmitType<BatchCancelArgs>
Triggers before records are cancelled in batch mode.
EmitType<BatchDeleteArgs>
Triggers when records are deleted in batch mode.
EmitType<BeforeBatchAddArgs>
Triggers before records are added in batch mode.
EmitType<BeforeBatchDeleteArgs>
Triggers before records are deleted in batch mode.
EmitType<BeforeBatchSaveArgs>
Triggers before records are saved in batch mode.
EmitType<BeforeCopyEventArgs>
Triggers before the TreeGrid copy action is initiated.
EmitType<BeforeDataBoundArgs>
Triggers before data is bound to the TreeGrid.
EmitType<Object>
Triggers before TreeGrid data is exported to an Excel file.
EmitType<BeforePasteEventArgs>
Triggers before the TreeGrid paste action is initiated.
EmitType<Object>
Triggers before TreeGrid data is exported to a PDF document.
EmitType<PrintEventArgs>
Triggers before the print action begins.
EmitType<BeginEditArgs>
Triggers before a record is edited.
EmitType<CellDeselectEventArgs>
Triggers when a selected cell is deselected.
EmitType<CellDeselectEventArgs>
Triggers before a selected cell is deselected.
EmitType<CellEditArgs>
Triggers when a cell is being edited.
EmitType<CellSaveArgs>
Triggers when a cell is being saved.
EmitType<CellSaveArgs>
Triggers after a cell is saved.
EmitType<CellSelectEventArgs>
Triggers after a cell is selected.
EmitType<CellSelectingEventArgs>
Triggers before any cell selection occurs.
EmitType<CheckBoxChangeEventArgs>
Triggers when the state of a checkbox changes in a checkbox column.
EmitType<RowCollapsedEventArgs>
Triggers after a TreeGrid record is collapsed.
EmitType<RowCollapsingEventArgs>
Triggers while a TreeGrid record is collapsing.
EmitType<ColumnDragEventArgs>
Triggers continuously while the column header is being dragged.
EmitType<ColumnDragEventArgs>
Triggers when column header dragging begins.
EmitType<ColumnDragEventArgs>
Triggers when a column header is dropped onto the target column.
EmitType<MenuEventArgs>
Triggers when there is a click on the column menu.
EmitType<ColumnMenuOpenEventArgs>
Triggers before the column menu opens.
EmitType<MenuEventArgs>
Triggers when an item in the context menu is clicked.
EmitType<BeforeOpenCloseMenuEventArgs>
Triggers before the context menu opens.
EmitType<Object>
Triggers when the component is created.
EmitType<Object>
Triggers when the data source is populated in the TreeGrid.
EmitType<DataSourceChangedEventArgs>
Triggers when data in the TreeGrid is added, deleted, or updated. Invoke the done method from the argument to start rendering after an edit operation.
EmitType<DataStateChangeEventArgs>
Triggers when TreeGrid actions such as sorting, paging, etc., are completed. The current view data and total record count should be assigned to the dataSource based on the action performed.
EmitType<DetailDataBoundEventArgs>
Triggers after a detail row expands. This event triggers initially during the first expand.
EmitType<ExcelExportCompleteArgs>
Triggers after TreeGrid data is exported to an Excel file.
EmitType<ExcelHeaderQueryCellInfoEventArgs>
Triggers before each header cell is exported to an Excel file, allowing customization of cells.
EmitType<ExcelQueryCellInfoEventArgs>
Triggers before each cell is exported to an Excel file, allowing customization of cells.
EmitType<RowExpandedEventArgs>
Triggers after a TreeGrid record is expanded.
EmitType<RowExpandingEventArgs>
Triggers while a TreeGrid record is expanding.
EmitType<HeaderCellInfoEventArgs>
Triggered for accessing header information.
EmitType<Object>
Allows customization of TreeGrid properties before rendering.
EmitType<PdfExportCompleteArgs>
Triggers after TreeGrid data is exported to a PDF document.
EmitType<PdfHeaderQueryCellInfoEventArgs>
Triggers before each header cell is exported to a PDF document, allowing customization of cells.
EmitType<PdfQueryCellInfoEventArgs>
Triggers before each cell is exported to a PDF document, allowing customization of cells.
EmitType<PrintEventArgs>
Triggers after the print action has been completed.
EmitType<QueryCellInfoEventArgs>
Triggered every time a request is made to access cell information, element, or data. This event is triggered before the cell element is appended to the TreeGrid element.
EmitType<RecordDoubleClickEventArgs>
Triggers when a record is double-clicked.
EmitType<ResizeArgs>
Triggers when column resizing starts.
EmitType<ResizeArgs>
Triggers when column resizing ends.
EmitType<ResizeArgs>
Triggers during column resizing.
EmitType<RowDataBoundEventArgs>
Triggered every time a request is made to access row information, element, or data. This event is triggered before the row element is appended to the TreeGrid element.
EmitType<RowDeselectEventArgs>
Triggers when a selected row is deselected.
EmitType<RowDeselectEventArgs>
Triggers before the selected row is deselected.
EmitType<RowDragEventArgs>
Triggers continuously while row elements are being dragged.
EmitType<RowDragEventArgs>
Triggers when row element dragging starts.
EmitType<RowDragEventArgs>
Triggers just before the row element dragging begins.
EmitType<RowDragEventArgs>
Triggers when a row element is dropped onto the target row.
EmitType<RowSelectEventArgs>
Triggers after a row is selected.
EmitType<RowSelectingEventArgs>
Triggers before row selection occurs.
EmitType<ClickEventArgs>
Triggers when a toolbar item is clicked.
Configures the TreeGrid aggregate rows.
Check the Aggregates for its configuration.
boolean
Enables exporting the TreeGrid to an Excel file if set to true.
Check the ExcelExport documentation for more details.
boolean
If allowFiltering
is set to true the filter bar will be displayed.
If set to false the filter bar will not be displayed.
Filter bar allows the user to filter tree grid records with required criteria.
boolean
If allowMultiSorting
set to true, then it will allow the user to sort multiple column in the treegrid.
allowSorting
should be true.
boolean
If allowPaging
is set to true, pager renders.
boolean
Enables exporting the TreeGrid to a PDF file if set to true.
Check the PdfExport documentation for more details.
boolean
If allowReordering
is set to true, TreeGrid columns can be reordered.
Reordering can be done by drag and drop of a particular column from one index to another index.
If TreeGrid is rendered with stacked headers, reordering is allowed only at the same level as the column headers.
boolean
If allowResizing
is set to true, TreeGrid columns can be resized.
boolean
If allowRowDragAndDrop
is set to true, row reordering functionality is enabled, allowing rows to be dragged
and dropped within the TreeGrid or across TreeGrids.
This feature enables users to reorganize data dynamically via drag-and-drop operations.
boolean
If allowSelection
is set to true, selection of (highlight row) TreeGrid records by clicking is allowed.
boolean
If allowSorting
is set to true, it allows sorting of treegrid records when column header is clicked.
boolean
If allowTextWrap
set to true,
then text content will wrap to the next line when its text content exceeds the width of the Column Cells.
boolean
If autoCheckHierarchy
is set to true, hierarchy checkbox selection is enabled in TreeGrid.
string
Specifies the mapping property path for child records in data source
<div id="TreeGrid"></div>
import { TreeGrid } from '@syncfusion/ej2-treegrid';
let treegrid: TreeGrid = new TreeGrid(
{
dataSource: summaryRowData,
childMapping: 'children',
});
treegrid.appendTo('#TreeGrid');
ClipMode
Defines the options for printing the TreeGrid. The available print modes are:
AllPages
: Prints all pages of the TreeGrid.CurrentPage
: Prints only the current page of the TreeGrid. ColumnMenuItem[]
| ColumnMenuItemModel[]
columnMenuItems
defines both built-in and custom column menu items.
The available built-in items are,
AutoFitAll
- Auto fit the size of all columns.AutoFit
- Auto fit the current column.SortAscending
- Sort the current column in ascending order.SortDescending
- Sort the current column in descending order.Filter
- Filter options will show based on filterSettings property like filterbar, menu filter. ColumnQueryModeType
Specifies how data is retrieved from the data source for the TreeGrid. The available modes are:
All
: Retrieve the entire data source.Schema
: Retrieve data only for defined columns.ExcludeHidden
: Retrieve data only for visible columns in the TreeGrid. ColumnModel[]
| string[]
| Column[]
Defines the schema of dataSource.
If the columns
declaration is empty or undefined then the columns
are automatically generated from data source.
<div id="TreeGrid"></div>
import { TreeGrid } from '@syncfusion/ej2-treegrid';
let treegrid: TreeGrid = new TreeGrid(
{
dataSource: summaryRowData,
childMapping: 'children',
treeColumnIndex: 0,
columns: [
{ field: 'taskID', headerText: 'Task ID', width: 130 },
{ field: 'taskName', width: 200, headerText: 'Task Name', width: 130 },
{ field: 'duration', headerText: 'Duration', width: 140 },
{ field: 'progress', headerText: 'Progress', width: 140 }
]
});
treegrid.appendTo('#TreeGrid');
ContextMenuItem[]
| ContextMenuItemModel[]
contextMenuItems
defines both built-in and custom context menu items.
The available built-in items are,
AutoFitAll
- Auto fit the size of all columns.AutoFit
- Auto fit the current column.Edit
- Edit the current record.Delete
- Delete the current record.Save
- Save the edited record.Cancel
- Cancel the edited state.PdfExport
- Export the grid as Pdf format.ExcelExport
- Export the grid as Excel format.CsvExport
- Export the grid as CSV format.SortAscending
- Sort the current column in ascending order.SortDescending
- Sort the current column in descending order.FirstPage
- Go to the first page.PrevPage
- Go to the previous page.LastPage
- Go to the last page.NextPage
- Go to the next page.copyHierarchyMode
Defines the copy clipboard types.
The available built-in items are,
Parent
- Copy the selected data with parent record.Child
- Copy the selected data with child record.Both
- Copy the selected data with both parent and child record.None
- Copy only the selected record. Object
| DataManager
It is used to render TreeGrid table rows.
<div id="TreeGrid"></div>
import { TreeGrid } from '@syncfusion/ej2-treegrid';
import { summaryRowData } from './data-source';
let treegrid: TreeGrid = new TreeGrid(
{
dataSource: summaryRowData,
childMapping: 'children',
});
treegrid.appendTo('#TreeGrid');
string
| Function
The detail template allows you to show or hide additional information about a particular row.
It accepts either the template string or the HTML element ID.
Configures the edit settings.
boolean
If enableAdaptiveUI
is set to true, the pop-up UI will become adaptive to small screens,
and be used for filtering and other features.
<div id='treegrid'></div>
<script>
var treegridObj = new TreeGrid({ enableAdaptiveUI: true });
treegridObj.appendTo('#treegrid');
</script>
boolean
If enableAltRow
is set to true, the TreeGrid will render with e-altrow
CSS class to the alternative tr elements.
Check the AltRow to customize the styles of alternative rows.
boolean
If enableAutoFill
is set to true, then the auto fill icon will displayed on cell selection for copy cells.
It requires the selection mode
to be Cell and cellSelectionMode
to be Box
.
boolean
Specifies whether to load all rows in a collapsed state when the TreeGrid is initially rendered. This setting is particularly useful when dealing with large datasets, as it helps enhance loading performance by reducing initial data rendering.
boolean
Enables column virtualization in the TreeGrid. When set to true
, only columns visible within the viewport are rendered.
Additional columns are loaded as you horizontally scroll. This is beneficial for rendering large datasets efficiently.
boolean
If enableHover
is set to true, the row hover is enabled in the TreeGrid.
boolean
Determines whether to sanitize untrusted HTML content in the TreeGrid. If true
, potentially harmful HTML strings
and scripts are sanitized before rendering to protect against XSS attacks.
boolean
If enableImmutableMode
is set to true, the TreeGrid will reuse old rows if it exists in the new result instead of
full refresh while performing the TreeGrid actions.
boolean
Enables infinite scrolling in the TreeGrid. When set to true
, additional data is loaded as the scrollbar
reaches the end. Useful for handling large datasets.
boolean
Enable or disable persisting component’s state between page reloads.
boolean
Enable or disable rendering component in right to left direction.
boolean
Specifies whether to display shimmer effect during scrolling action in virtual scrolling feature. If disabled, spinner is shown instead of shimmer effect.
boolean
If enableVirtualization
set to true, then the TreeGrid will render only the rows visible within the view-port
and load subsequent rows on vertical scrolling. This helps to load large dataset in TreeGrid.
string
Specifies the mapping property path for the expand status of a record in data source.
Configures the filter settings of the TreeGrid.
number
Specifies the number of columns that should remain visible and fixed on the left side of the TreeGrid during horizontal scrolling. This feature ensures key columns, such as identifiers, stay visible while users scroll through data.
number
Specifies the number of rows that should remain visible and fixed at the top of the TreeGrid during scrolling. This feature helps improve readability in data-heavy grids by keeping the header rows or key rows visible.
GridLine
Defines how TreeGrid content lines are displayed, determining the visibility of vertical and horizontal lines.
Both
: Displays both horizontal and vertical grid lines.None
: Hides both horizontal and vertical grid lines.Horizontal
: Displays only horizontal grid lines.Vertical
: Displays only vertical grid lines.Default
: Adjusts line visibility based on the theme. string
Specifies whether record is parent or not for the remote data binding
string
| number
Defines the scrollable height of the TreeGrid content.
string
Specifies the name of the field in the dataSource, which contains the id of that row.
<div id="TreeGrid"></div>
import { TreeGrid } from '@syncfusion/ej2-treegrid';
let treegrid: TreeGrid = new TreeGrid(
{
dataSource: projectData,
idMapping: 'TaskID',
parentIdMapping: 'parentID',
});
treegrid.appendTo('#TreeGrid');
Configures settings for infinite scrolling.
boolean
When enabled, only parent records would be rendered during the initial render and child records will be loaded only when expanding a parent record. This property is only applicable for remote data binding. Loading child records on demand can improve the performance of data-bound controls with a large number of records. Child records are only loaded when they are requested, rather than loading all child records at once.
Configures the loading indicator of the Tree Grid. Specifies whether to display spinner or shimmer effect during the waiting time on any actions (paging, sorting, filtering, CRUD operations) performed in Tree Grid.
string
Overrides the global culture and localization value for this component. Default global culture is ‘en-US’.
Configures the pager in the TreeGrid.
string
Specifies the name of the field in the dataSource, which contains the parent’s id
<div id="TreeGrid"></div>
import { TreeGrid } from '@syncfusion/ej2-treegrid';
let treegrid: TreeGrid = new TreeGrid(
{
dataSource: projectData,
idMapping: 'TaskID',
parentIdMapping: 'parentID',
});
treegrid.appendTo('#TreeGrid');
PrintMode
Defines the options for printing the TreeGrid. The available print modes are:
AllPages
: Prints all pages of the TreeGrid.CurrentPage
: Prints only the current page of the TreeGrid. Query
Defines the external Query that will be executed along with data processing.
RowDropSettingsModel
Configures the row drop settings of the TreeGrid.
number
Defines the height of TreeGrid rows.
string
| Function
The row template that renders customized rows from the given template. By default, TreeGrid renders a table row for every data source item.
- It accepts either template string or HTML element ID.
- The row template must be a table row. Check the Row Template customization.
Configures the search settings of the TreeGrid.
number
Specifies the index of the row to be selected upon initial rendering. Also retrieves the index of the currently selected row.
Configures the selection behavior.
boolean
If showColumnChooser
is set to true, it allows you to dynamically show or hide columns.
boolean
If showColumnMenu
set to true, then it will enable the column menu options in each columns.
Check the Column menu for its configuration.
Configures the sort settings of the TreeGrid.
Configures the text wrap in the TreeGrid.
[]
toolbar
defines the ToolBar items of the TreeGrid.
It contains built-in and custom toolbar items.
If a string value is assigned to the toolbar
option, it is considered as the template for the whole TreeGrid ToolBar.
If an array value is assigned, it is considered as the list of built-in and custom toolbar items in the TreeGrid’s Toolbar.
The available built-in ToolBar items are:
number
Specifies the index of the column that needs to have the expander button.
string
| number
Defines the TreeGrid width.