Page 1 of 1

Gantt 5.3.0 - Filter/find resource on Resources tab not working with "last name"

Posted: Tue May 30, 2023 4:12 pm
by MauriceLapre

Hi Bryntum,

I'm using Gantt 5.3.0 at the moment. My resources have a first name and a last name. On the Resources tab, when adding a record, the resources are displayed correctly but filtering/finding by typing in the combobox seems to work as a "starting with". E.g. if I have a resource Celia Green, typing "green", "elia" or something similar is not showing that resource. Only when you start typing beginning with "c", it will find Celia.

This is reproducible in the Resource Utilization demo.

Is it possible to change this to a "contains" filtering?

Thank you.


Re: Gantt 5.3.0 - Filter/find resource on Resources tab not working with "last name"

Posted: Tue May 30, 2023 4:44 pm
by tasnim

Hi,

You could achieve it by applying this

    features : {
        taskEdit : {
            items : {
                resourcesTab : {
                    items : {
                        grid : {
                            columns : {
                                data : {
                                    resource : {
                                        editor : {
                                            listeners : {
                                                input(props) {
                                                    const { source, value } = props;
                                                    source.store.clearFilters();
                                                    source.store.filter(record => record.name.toLowerCase().includes(value.toLowerCase()));
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

Docs
https://bryntum.com/products/gantt/docs/api/Gantt/feature/TaskEdit
https://bryntum.com/products/gantt/docs/api/SchedulerPro/widget/taskeditor/ResourcesTab
https://bryntum.com/products/gantt/docs/api/Core/data/Store


Re: Gantt 5.3.0 - Filter/find resource on Resources tab not working with "last name"

Posted: Wed May 31, 2023 10:03 am
by MauriceLapre

I can give that a try, thank you! But if I look at this, it is not intended to be a "contains"-like filter?


Re: Gantt 5.3.0 - Filter/find resource on Resources tab not working with "last name"

Posted: Wed May 31, 2023 10:48 am
by tasnim

Hi,

I used the javascript includes method in the above post
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes

Isn't it the behavior you wanted to achieve?


Re: Gantt 5.3.0 - Filter/find resource on Resources tab not working with "last name"

Posted: Wed May 31, 2023 1:45 pm
by MauriceLapre

Ah no wait, I see the confusion from my earlier reply. Yes, making your suggested change and using includes will probably work. I meant to say is that the default behavior of filtering on this field is by design not using includes. Maybe that could be an improvement.


Re: Gantt 5.3.0 - Filter/find resource on Resources tab not working with "last name"

Posted: Thu Jun 01, 2023 8:21 pm
by marcio

Hey MauriceLapre,

I created a ticket for discussion about that change - https://github.com/bryntum/support/issues/6909


Re: Gantt 5.3.0 - Filter/find resource on Resources tab not working with "last name"

Posted: Fri Jun 02, 2023 2:12 pm
by marcio

Hey MauriceLapre,

Just FYI, there is a configuration that you could check about that
https://bryntum.com/products/gantt/docs/api/Core/widget/Combo#config-filterOperator

features : {
        taskEdit : {
            items : {
                resourcesTab : {
                    items : {
                        grid : {
                            columns : {
                                data : {
                                    resource : {
                                        editor : {
                                            filterOperator : '*'
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

Re: Gantt 5.3.0 - Filter/find resource on Resources tab not working with "last name"

Posted: Fri Jun 02, 2023 4:17 pm
by MauriceLapre

Works like a charm, thanks!