Page 1 of 1

[ANGULAR] How to search through resources?

Posted: Fri May 26, 2023 3:56 pm
by cokguzel

Hi! How I can perform search through resources with tree view (I need search through the all levels of the tree)?
I found feature for filtering events. And I found search for Grid. But I wasn't able to find search feature for resources in Scheduler.
And also I need to perform that search for search term from my custom input which is outside of Bryntum Scheduler.


Re: [ANGULAR] How to search through resources?

Posted: Fri May 26, 2023 4:11 pm
by mats

Grid features can also be used in the Scheduler since the Scheduler subclasses the Grid. Demo: https://bryntum.com/examples/scheduler/filtering


Re: [ANGULAR] How to search through resources?

Posted: Tue May 30, 2023 1:26 pm
by cokguzel

I wasn't able to find an example how to use Grid search within Scheduler
In the example from the link you shared there's a search from column header (for resources) and from toolbar (for events).
But I need search from my custom input
I was trying something like this but it doesn't work

  /**
   * Runs after the view (including the child scheduler) is initializes
   */
  ngAfterViewInit (): void {
    this.scheduler = this.schedulerProComponent.instance;
    this.scheduler.features.search('Elizabeth');
  }

I need to search through all levels of my resources which is tree hierarchy. And I need to show results together with children. I checked documentation. But I still don't have any idea how to implement that and if it's possible to implement that


Re: [ANGULAR] How to search through resources?

Posted: Tue May 30, 2023 1:29 pm
by mats

This works:

    this.scheduler.features.search.search('Mike');


Re: [ANGULAR] How to search through resources?

Posted: Tue May 30, 2023 1:36 pm
by cokguzel
mats wrote: Tue May 30, 2023 1:29 pm

This works:

    this.scheduler.features.search.search('Mike');

Thanks. I tried this and seems like this functionality doesn't male what I need. It just highlight the search term. Seems like I need filter for resources. I tried this but it's a filter for events. How I can perform the same but for resources?

    this.scheduler.eventStore.filter({
      filters: event => event.name.match(new RegExp(value, 'i')),
      replace: true
    });

Re: [ANGULAR] How to search through resources?

Posted: Tue May 30, 2023 1:58 pm
by mats

Sounds like this is what you want? https://bryntum.com/examples/scheduler/filtering


Re: [ANGULAR] How to search through resources?

Posted: Tue May 30, 2023 2:36 pm
by cokguzel
mats wrote: Tue May 30, 2023 1:58 pm

Sounds like this is what you want? https://bryntum.com/examples/scheduler/filtering

You previously posted this link. I checked it and there's resources filter within Sheduler's header. But I need to perform resources filtering via input which is outside of the Scheduler


Re: [ANGULAR] How to search through resources?

Posted: Tue May 30, 2023 2:53 pm
by marcio

Hey cokguzel,

You could use the same approach that you mentioned here for eventStore viewtopic.php?p=125079#p125079 but for a resourceStore

https://bryntum.com/products/schedulerpro/docs/api/Scheduler/data/ResourceStore


Re: [ANGULAR] How to search through resources?

Posted: Tue May 30, 2023 3:19 pm
by cokguzel
marcio wrote: Tue May 30, 2023 2:53 pm

Hey cokguzel,

You could use the same approach that you mentioned here for eventStore viewtopic.php?p=125079#p125079 but for a resourceStore

https://bryntum.com/products/schedulerpro/docs/api/Scheduler/data/ResourceStore

Thanks! It works. The only issue for now is that I perform search through tree and when I'm looking for children it works fine for me and shows the whole tree of the current it (from child to parent).
but when I'm looking for parent node it shows only parent node without children. How I can get results including children while searching for parent?

It is how I'm filtering resources now

    this.scheduler.resourceStore.filter({
      filters: resource => {
        return resource.name.includes('Julia');
      },
      replace: true
    });

Re: [ANGULAR] How to search through resources?

Posted: Tue May 30, 2023 4:51 pm
by marcio

Hey cokguzel,

I believe that's how is supposed to work. Cause you're using a tree structure, when you search for a child, you need to have all the parent structures displayed. But when you filter a parent node, you (in theory) won't need the information related to the child nodes.

Perhaps a possible workaround that you could try is to add an or condition with the name filter and search for parent (if exists) and compare the parent name also.