@{
string[] items = new string[] { "NewFolder", "Upload", "Delete", "Download", "Rename", "SortBy", "Refresh", "Selection", "View", "Details", "Custom" };
}
<div class="control-section">
<div class="sample-container">
<!-- Filemanager element declaration -->
@Html.EJS().FileManager("file").AjaxSettings(new Syncfusion.EJ2.FileManager.FileManagerAjaxSettings()
{
Url = "/Home/FileOperations",
GetImageUrl = "/Home/GetImage",
UploadUrl = "/Home/Upload",
DownloadUrl = "/Home/Download"
}).ToolbarSettings(new Syncfusion.EJ2.FileManager.FileManagerToolbarSettings()
{
Items = items
}).ToolbarCreate("onToolbarCreate").FileSelect("FileSelect").Created("onCreate").Render()
<!-- end of filemanager element -->
</div>
</div>
<script>
// enabling and disabling the custom toolbar item based on selected file count
function FileSelect(args) {
if (this.getSelectedFiles().length == 1) {
this.enableToolbarItems(["Custom"]);
} else {
this.disableToolbarItems(["Custom"]);
}
}
function onToolbarCreate(args) {
for (var i = 0; i < args.items.length; i++) {
if (args.items[i].id === this.element.id + '_tb_custom') {
args.items[i].prefixIcon = 'e-icons e-fe-tick';
}
}
}
function onCreate(args) {
//disabling the custom toolbar item on initial render
this.disableToolbarItems(["Custom"]);
}
</script>
<style>
.e-fe-tick::before {
content: '\e614';
}
/*setting visibility hidden stop the disabled toolbar item*/
#file .e-toolbar-item.e-overlay {
visibility: hidden;
}
</style> |