Our pure JavaScript Scheduler component


Post by rupen.shah.access »

Dear There,

I have added bryntum scheduler with tree type resource. When I search with the keyword which is find in parent level it does not return its child. It only show the parent value and hide the expandable arrow.

Could you please guide me how i can set the feature so that it return the all data beneath it.


Post by marcio »

Hey rupen.shah.access,

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. You can see a snippet of how to use a function to filter here https://bryntum.com/products/scheduler/docs/api/Core/data/mixin/StoreFilter

Best regards,
Márcio


Post by rupen.shah.access »

Could you please guide with more details for how to apply filter as i am not able to find it from the above link.


Post by alex.l »

I tried here https://bryntum.com/products/scheduler/examples/tree/

With very basic code from docs. Try in console

scheduler.resourceStore.filter({
    property : 'name',
    value    : 'Gate 1',
    operator : 'includes'
});

It filters child nodes pretty well. What exactly is not clear/not working for you?

All the best,
Alex


Post by alex.l »

Search is also working pretty good in there. Try

scheduler.resourceStore.search('Gate 1', ['name'])

https://bryntum.com/products/scheduler/docs/api/Core/data/Store#function-search

All the best,
Alex


Post by rupen.shah.access »

Dear Team,

Thanks for your quick reply.

Here what I want is when user search the keyword which is part of parent tree then I want to show all its child. If you execute the below code.

scheduler.resourceStore.filter({
    property : 'name',
    value    : 'Airport',
    operator : 'includes'
});

You will find only one row it shows but not their child's beneath it.

Let me know if its unclear.

Thanks
Rupen


Post by alex.l »

Hi Rupen,

All you need is to create a filter function that will do what you want and return result you need.
Try this

scheduler.resourceStore.filter((r)=>r.name.indexOf('Terminal A') > -1 || (r.parent?.name?.indexOf('Terminal A') > -1));

If you need to check more parent levels, just add it.

All the best,
Alex


Post Reply