Our blazing fast Grid component built with pure JavaScript


Post by janan »

https://www.bryntum.com/examples/grid/filterbar/

In the above example is it possible to initialize filter bar with all the values in filter items.
Image

Attachments
Screen Shot 2021-06-07 at 09.35.41.png
Screen Shot 2021-06-07 at 09.35.41.png (43.17 KiB) Viewed 84 times

Post by pmiklashevich »

Hello,

It's a bit tricky, but doable. You need to configure initial filter. And since the filter allows multiple values, you need to define the default filter function:

    features : {
        filterBar : {
            compactMode : false,
            filter      : {
                property : 'city',
                value    : ['Paris', 'Barcelona'],
                filterBy(record) {
                    return !this.value.length || this.value.includes(record.city);
                }
            }
        },

Then also need to specify values for the combo field used for filtering and the filtering function.

            filterable : {
                // filterField : cityCombo,
                filterField : Object.assign(cityCombo, {
                    value : ['Paris', 'Barcelona']
                }),
                filterFn : ({ record, value }) => !value.length || value.includes(record.city)
            }

Opened a ticket to avoid code duplication: https://github.com/bryntum/support/issues/2993

Pavlo Miklashevych
Sr. Frontend Developer


Post Reply