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

FileBrowser thumbnail image (file type)

3 Answers 154 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Matjaz
Top achievements
Rank 1
Matjaz asked on 08 Oct 2014, 09:39 AM
How can I set thumbnail image for FileBrowser. ImageBrowser has thumbnailUrl configuration.
I would like to show pdf icon if the file is pdf, word icon if the file is word, zip icon if the file is archive ...

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 10 Oct 2014, 07:31 AM
Hello Matjaz,

You can use the dataBound event of the ListView widget inside the FileBrowser to iterate all <li> elements and apply custom CSS styles, depending on the file name inside.

http://www.telerik.com/forums/readonly-folders-for-file-and-image-browser

Regards,
Dimo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Matjaz
Top achievements
Rank 1
answered on 16 Oct 2014, 08:17 AM
Hi.
I need this functionality for FileBrowser and for Editor->FileBrowser.
I already extend you widgets with my own. The best logic would be to do this inside init method:
var MatjazEditor = kendo.ui.Editor.extend(
    {
        init: function(element, options)
        {
            if (options.tools != undefined)
            {
                if (options.tools.indexOf("insertImage") != -1)
                    Matjaz.InitImageBrowser(options.imageBrowser);
                if (options.tools.indexOf("insertFile") != -1)
                    Matjaz.InitFileBrowser(options.fileBrowser);
            }
             
            kendo.ui.Editor.fn.init.call(this, element, options);
            kendo.notify(this);
        },
        options:
        {   
            name: "MatjazEditor",
        }
    });
    kendo.ui.plugin(MatjazEditor);
I am having problem with getting listView reference as pointed in url you provided.
Please help me, how can I get listView in FileBrowser and Editor->FileBrowser.
0
Dimo
Telerik team
answered on 20 Oct 2014, 07:46 AM
Hello Matjaz,

The File and Image Browsers of the Editor are created on demand, when the respective popup is opened, and they are destroyed, when the popup is closed. The File and ImageBrowsers do not exist in the init event of the Editor, so the internal ListView widget does not exist then either. You need to think of some other approach, for example extend the FileBrowser widget as well and add a custom dataBound handler there in its init method. Keep in mind that the ListView already has a dataBound handler attached, so in order to preserve it, attach you custom handler with bind.

http://docs.telerik.com/kendo-ui/basics/events-and-methods#bind-to-the-widget-events

Regards,
Dimo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Editor
Asked by
Matjaz
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Matjaz
Top achievements
Rank 1
Share this question
or