// File Manager’s created event function
onCreated(args) {
var i = 0;
// Get all the toolbar items span element which contains the text
var toolbarItems = this.fileManagerInstance.toolbarModule.toolbarObj.element.querySelectorAll('.e-tbar-btn-text');
while (i < toolbarItems.length) {
// If it is the custom toolbar item, then store its item element in private variable
this.customToolElement = (toolbarItems[i].innerHTML === "Custom") ? toolbarItems[i].closest('.e-toolbar-item') : ''
i++;
}
// Add e-hidden class to the custom toolbar item’s element
this.customToolElement.classList.add('e-hidden');
} |
// File Manager’s fileSelect event function
onFileSelect(args) {
if (args.action as any === "select") {
// Checks if selected item is folder and contains e-hidden class
if (!args.fileDetails.isFile && this.customToolElement.classList.contains('e-hidden'))
// Remove the class from custom toolbar item
this.customToolElement.classList.remove('e-hidden');
// Checks if selected item is file and does not contain e-hidden class
else if (args.fileDetails.isFile && !this.customToolElement.classList.contains('e-hidden'))
// Add the class to custom toolbar item
this.customToolElement.classList.add('e-hidden');
}
// Add class to custom toolbar item on unselect action when selected items is 0
else if (args.action as any === "unselect" && this.fileManagerInstance.selectedItems.length === 0)
}
} |