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

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

3 Answers 57 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Matjaz
Top achievements
Rank 1
Matjaz asked on 07 Oct 2014, 06:58 PM
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.

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 09 Oct 2014, 05:12 PM
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!
 
0
Matjaz
Top achievements
Rank 1
answered on 16 Oct 2014, 08:27 AM
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.)
0
Dimo
Telerik team
answered on 20 Oct 2014, 07:38 AM
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!
 
Tags
Editor
Asked by
Matjaz
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Matjaz
Top achievements
Rank 1
Share this question
or