search bar apply to all directory instead of current path

Hi,

I want to be able to search a file by file name from all the directories instead of search within the current path. Is it possible to achieve?
I'm using my own backend services and it does return all the files that matched the search query from all directories but when I tried to open folder from the search result its making two read request to the backend. first request was success and returned with correct data but second request was throwing error because the request param data is null => (
    1. action"read"
    2. path"/l/"
). I tried to avoid making the second request and allow only first request to go thru but even when the request and response are correct it doesn't update the data in the file manager. 

3 Replies 1 reply marked as answer

IL Indhumathy Loganathan Syncfusion Team March 15, 2021 11:14 AM UTC

Hi Jialing, 
 
Greetings from Syncfusion support. 
 
We have validated your reported query in FileManager component. Please find the answer for your queries. 
 
Query 1: Search a file by file name from all the directories instead of search within the current path 
 
By default, FileManager search operation will be performed for all of its child and sub-child directories based on file name. Please share us clear details on the term “search a file by file name from all the directories instead of search within the current path” mentioned in your update. Whether you want to perform search for parent directories as well? This detail would help us to serve you better.  
 
Query 2: Avoid making the second read request 
 
You can use the beforeSend event to check whether the data is null. By setting args.cancel as true, you can avoid read request sent to sever in client side. 
 
Please check the below code snippet. 
 
  beforeSend(args: BeforeSendEventArgs) { 
    if (args.ajaxSettings.data == null) { 
      args.cancel = true; 
    } 
  } 
 
 
Kindly check this in your end. If we misunderstood your query, please share more details regarding your requirement in FileManager to assist you promptly. 
 
Please, let us know if you need any further assistance. 
 
Regards, 
Indhumathy L 



JI Jialing March 15, 2021 04:39 PM UTC

Hi,

Yes. I do want to be able to search for parent directories as well.


IL Indhumathy Loganathan Syncfusion Team March 16, 2021 10:40 AM UTC

Hi Jialing, 
 
We have validated your requirement.  
 
In FileManager component, we have performed searching and all other file operations based on the current path. Searching for parent directories is not possible because all the operations are designed based on the current path. Modifying the path to perform searching in directories, will affect navigations and other file operations. 
 
Please refer to the below link. 
 
 
However, you can write your own service for searching parent directory and need to modify all the file operations for that scenario. 
 
Please let us know if you need further assistance. 
 
Regards, 
Indhumathy L 


Marked as answer
Loader.
Up arrow icon