When search is active (Image/FileBrowser), new folder is not visible

4 posts, 0 answers
  1. Matjaz
    Matjaz avatar
    94 posts
    Member since:
    Jun 2014

    Posted 07 Oct 2014 Link to this post

    I was testing search and enter f. It works.
    Then I wanted to create new directory, but it didn't work. I pressed button several times, nothing. The search was on.

    I think new directory should appear always not just to match filter. At least until the name is confirmed. If this is expected behaviour (hope not, because it doesn't have any sense) how can I change it?
    By clearing filter(search) or show directory always at least until the directory name is confirmed. Both ways would work for me.
  2. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 09 Oct 2014 Link to this post

    Hello Matjaz,

    The "search" feature of the ImageBrowser actually represents a filtering of the dataSource of a Kendo UI ListView. This explains why the newly created folder will be displayed only if the filtering parameter is removed or if the new folder's default name meets the filtering criterion.

    What we can do in terms of widget behavior is reset the filtering automatically when the user clicks on the "Add Folder" icon. Any other solution that will display a dataSource item, which does not meet the currently applied filtering settings, would represent a hack.

    You can remove the applied filtering on "Add Folder" button click like this:

    $(".k-addfolder").parent().mousedown(function(e){
       var fileBrowserElement = $(e.target).closest(".k-filebrowser");
       fileBrowserElement.find(".k-search-wrap input").val("");
       fileBrowserElement.find(".k-listview").data("kendoListView").dataSource.filter({});
    });

    The above handler should be attached after the file/image browser has been created and displayed:

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. Matjaz
    Matjaz avatar
    94 posts
    Member since:
    Jun 2014

    Posted 16 Oct 2014 in reply to Dimo Link to this post

    Can you please confirm, that this code only enable showing new folder even if it's not meet the search criteria.
    Filter input field is not cleared and the files are not shown again. (This could work for me.)
  5. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 20 Oct 2014 Link to this post

    Hi Matjaz,

    The provided code attaches a mousedown event handler to the "Add Folder" button, which does the following:

    - obtains a reference to the FileBrowser wrapper element
    - finds the search textbox and clears its value
    - obtains a reference to the ListView widget inside the FileBrowser and removes its dataSource's filtering settings - this will allow the newly added folder to be displayed for renaming

    If the code does not work on your side, then you the event handler is probably not attached correctly. Please refer to the forum thread link in my previous reply, which shows how to use a click handler on the "Insert file" (.k-insertFile) or "Insert image" (.k-insertImage) buttons and use any subsequent code in setTimeout.

    Regards,
    Dimo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready