This is a migrated thread and some comments may be shown as answers.

New File Indicator

1 Answer 42 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Vinh
Top achievements
Rank 1
Vinh asked on 19 Mar 2012, 09:39 PM
Hi, I'm looking an either client-side or server-side to either append '*' to the Folder Name or switch the icon.  Right now, we're only allowing members to download the files and we keep that the download status.

Thanks
Vinh Vu

1 Answer, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 21 Mar 2012, 12:44 PM
Hi Vinh,

I already answered your support ticket on the subject. For convenience I will paste my answer here as well.

If I understand you correctly, you need to mark the newly uploaded files with a marker in the file list. RadFileExplorer does not offer such functionality out-of-the-box. Nevertheless, to achieve this I would suggest you to sub-class the FileSystemContentProvider class and override its StoreFile() and ResolveDirectory() methods.
  1. In the StoreFile() method save information of the uploaded file(for example in a database) to mark it as latest upload.
  2. In the ResolveDirectory() check if any of the files is marked as latest upload, and if so add a custom attribute to it (as demonstrated in this live demo).
  3. Handle the RadFileExplorer's ClientFolderLoaded client-side event and change the icon of the grid's row, e.g.:
    function OnClientFolderLoaded(oExplorer, args)
    {
        var dataItems = oExplorer.get_grid().get_masterTableView().get_dataItems();
     
        for (var i = 0; i < dataItems.length; i++) {
            //get reference to the data item
            var item = dataItems[i];
     
            //get the value of the "CustomAttribute"
            var itemCustomAttribute = item.get_dataItem().Attributes["CustomAttribute"];
     
            if (itemCustomAttribute == "CustomAttributeValue") {
                //change the background image
                $telerik.$("td:first-child", item.get_element()).css("background-image", "url('latestUploadIcon.gif')");
            }
        }
    }

More information regarding the RadFileExplorer's content provider is available in the following help article:
Using custom FileBrowserContentProvider


Regards,
Dobromir
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
FileExplorer
Asked by
Vinh
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Share this question
or