We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

[FileManager] How to include author in the file manager columns?

Hello.

There is a way to add extra columns in the file manager?
If there is, how much of the file metadata could be available to us? 
It would be great if at least the author of the file could be there.

Thanks in advance and keep up the great work.

5 Replies

KR Keerthana Rajendran Syncfusion Team October 31, 2019 07:13 AM UTC

Hi Rodrigo, 
 
We have checked your reported query to add the additional column for details view. You can add the addition column to the filemanager component using detailsViewSetttings. 
 
Refer the below code snippet to add the additional column. 
 
let fileObject: FileManager = new FileManager({ 
  detailsViewSettings: { 
    columns: [ 
      { 
        field: "name", headerText: "File Name", minWidth: 120, width: "100", 
      }, 
      { 
        field: "size", headerText: "File Size", minWidth: 50, width: "110" 
      }, 
      { field: 'dateModified', headerText: 'Date Modified',minWidth: 50, width: '190'}, 
      { field: 'dateCreated', headerText: 'Date Created',minWidth: 50, width: '190'}, 
      { field: "author", headerText: "Author", minWidth: 50, width: '190' } 
    ] 
  } 
}); 
fileObject.appendTo("#filemanager"); 
 
 
You can identify the additional column field value in your network tab. Refer to the below screenshot. 
 
 
If you want to add the custom parameter like author. you can modify the controller part and send the value for author in server side. 
 
Refer the below code snippet to add the value for author. 
      public object getFiles(FileManagerDirectoryContent args) 
       { 
            FileResponse readResponse = new FileResponse(); 
            try 
            { 
                var value = this.operation.GetFiles(args.Path, args.ShowHiddenItems); 
                DirectoryContent cwd = new DirectoryContent(); 
                readResponse.CWD = JsonConvert.DeserializeObject<DirectoryContent>(JsonConvert.SerializeObject(value.CWD)); 
                readResponse.Files = JsonConvert.DeserializeObject<IEnumerable<DirectoryContent>>(JsonConvert.SerializeObject(value.Files)); 
                foreach (DirectoryContent file in readResponse.Files) 
                { 
                    //Get the value of author 
                    file.Author = args.IsFile ? "File" : "Syncfusion"; 
                } 
                readResponse.Details = value.Details; 
                readResponse.Error = value.Error; 
                return readResponse; 
            } 
            catch 
            { 
                ErrorDetails er = new ErrorDetails(); 
 
            } 
            return this.operation.ToCamelCase(this.operation.GetFiles(args.Path, args.ShowHiddenItems)); 
        } 
 
case "read": 
          // reads the file(s) or folder(s) from the given path.               
           return this.getFiles(args); 
 
For your reference, we have prepared a sample. In that sample, we have added the additional and custom parameter. 
 
Refer the sample link below. 
 
 
 
Note:  Run the local service and refer the local host URL in file manager sample. 
 
Please let us know, if you have need further assistance on this. 
 
Regards, 
 
Keerthana. 



RO Rodrigo November 1, 2019 03:36 PM UTC

Thank you for the awesome reply.
Solved


KR Keerthana Rajendran Syncfusion Team November 4, 2019 05:14 AM UTC

Hi Rodrigo,  
 
Most welcome. We are glad to hear that the issue has been resolved at your end. Please get back to us if you need further assistance on this. 
 
Regards, 
Keerthana. 



UN Unknown Syncfusion Team January 30, 2020 08:25 AM UTC

Hi Keerthana,

Could you please provide MVC sample. w eare getting the response attahed with below sample

Attachment: test_12dede3d.zip


SA Shameer Ali Baig Sulaiman Ali Baig Syncfusion Team January 30, 2020 11:45 AM UTC

Hi Rodrigo, 
 
We have prepared a ASP.NET MVC sample with the above given solution for your reference. 
 
Please, find the sample from the below link. 
 
 
Please, let us know if you need any further assistance. 
 
Regards, 
Shameer Ali Baig S. 


Loader.
Live Chat Icon For mobile
Up arrow icon