Premium support for our pure JavaScript UI components


Post 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.

Attachments
Schermafbeelding 2023-05-30 160225.png
Schermafbeelding 2023-05-30 160225.png (118.23 KiB) Viewed 383 times

Post 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


Post 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?


Post 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?


Post 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.


Post by marcio »

Hey MauriceLapre,

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

Best regards,
Márcio


Post 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 : '*'
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

Best regards,
Márcio


Post by MauriceLapre »

Works like a charm, thanks!


Post Reply