Our blazing fast Grid component built with pure JavaScript


Post by clickcut »

How to show only certain operators in filters Panel

this is my code:

 const app = new Container({
                                                     layout: 'hbox',
                                                     appendTo: 'container',
                                                     items: {
                                                         grid,
                                                         splitter: {
                                                             type: 'splitter'
                                                         },
                                                         filtersPanel: {
                                                             type: 'panel',
                                                             cls: 'filters-panel',
                                                             title: 'Filters',
                                                             collapsible: true,
                                                             collapsed: true,
                                                             layout: {
                                                                 type: 'vbox',
                                                                 align: 'start'
                                                             },
                                                             flex: 1,
                                                             maxWidth: '35em',
                                                             items: {
                                                                 enableAllCheckbox: {
                                                                     type: 'checkbox',
                                                                     text: 'Enable/disable all',
                                                                     checked: true,
                                                                     listeners: {
                                                                         change: ({ checked }) => checked ? app.widgetMap.filterPickers.activateAll() : app.widgetMap.filterPickers.deactivateAll()
                                                                     }
                                                                 },
                                                                 filterPickers: {
                                                                     type: 'gridfieldfilterpickergroup',
                                                                     width: '100%',
                                                                     ref: 'filterPickers',
                                                                     // Provide our Grid's store & columns as the list of properties available for filtering
                                                                     grid,

                                                                 // From the available set of columns in grid.columns, only allow these in the filter property drop-downs
                                                                 allowedFieldNames: ['optionName', 'optionTypeName', 'libraryName','manufacturerName'],
                                                                 //filters: [{
                                                                 //    id: 'permanent-filter-1',
                                                                 //    property: 'optionName',
                                                                 //    operator: 'includes',
                                                                 //    caseSensitive: false
                                                                 //}],

                                                                 listeners: {
                                                                     change: ({ filters }) => {
                                                                         console.log("In", filters);
                                                                         //grid.store.filter(filters);
                                                                         // Save filters to localStorage when they change
                                                                         localStorage.setItem(FILTERS_STORAGE_KEY, JSON.stringify(filters));
                                                                     }
                                                                 },

                                                                 //canDeleteFilter,
                                                                 //getFieldFilterPickerConfig
                                                             }
                                                         }
                                                     }
                                                 }
                                             });

Post by marcio »

Hey clickcut,

Thanks for reaching out.

We have https://bryntum.com/products/grid/docs/api/Grid/widget/GridFieldFilterPickerGroup#config-operators that you can change to match the operators that you want to use.

Best regards,
Márcio


Post by clickcut »

I'm facing an issue with filters. When I apply multiple filters and try to disable one of them, I'm still receiving all the filters in the backend, including the one that should be disabled. Please guide me on how to handle this.


Post by marcio »

Hey clickcut,

Is this filtering behavior related to the initial topic? It looks like it's not related to the initial discussion of this thread, and we have a rule of one thread per topic.

Could you please open a new thread with more details regarding your configuration and how you are disabling the filters?

Best regards,
Márcio


Post Reply