While TreeList does not have a built-in export feature, you can use the ExcelJS and FileSaver libraries to access a similar functionality.
- Install or reference the ExcelJS and file-saver packages.
- Add a reference to the
excelExporterfile (see theexcelExporterfile for your framework below). - Define the export button in the TreeList toolbar.
- Implement the export button's onClick handler and call the
exportTreeListmethod.
function exportToExcel() {
const workbook = new ExcelJS.Workbook();
const worksheet = workbook.addWorksheet('Employees');
exportTreeList({
component: treeList,
worksheet,
}).then(() => {
workbook.xlsx.writeBuffer().then((buffer) => {
saveAs(
new Blob([buffer], { type: 'application/octet-stream' }),
'Employees.xlsx',
);
});
});
}-
jQuery
-
Angular
-
Vue
-
React
-
NetCore
(you will be redirected to DevExpress.com to submit your response)
