Page 1 of 2

filter is not working when pushing old state back to grid

Posted: Thu Dec 12, 2024 4:32 pm
by dsingh7

Hi Team,

In my grid implementation I am storing grid state to backend and when user coming on the same grid I am pushing grid state and then after grid load pushing data to the grid.

Column config

filterable: {
        filterField : {
	    type : "combo",
	    multiSelect : true,
	    items : ["View","Edit","Owner","Co-owner"]
        },
        filterFn : ({ record, value }) => true
    },

So in above config I am passing filterFn to bypass grid filters and what ever data is there in column display regardless of filter.
This is working fine when user select filter on grid. Also this filter and sorting state is stored to backend. When user loading this grid again then data is not rendering in grid. this is happening for this dropdown type column.
if I remove and select another value for this filter then it starts working again.
Please suggest what I am doing wrong here


Re: filter is not working when pushing old state back to grid

Posted: Thu Dec 12, 2024 4:45 pm
by alex.l

Hi,

I am afraid, it's not clear what to do by description you shared. Please attach video with steps to reproduce.


Re: filter is not working when pushing old state back to grid

Posted: Thu Dec 12, 2024 4:54 pm
by dsingh7

So with above configuration when I am pushing old state to grid, data is not rendered in grid.
When I change any value in the given filter then it starts rendering data in grid.


Re: filter is not working when pushing old state back to grid

Posted: Thu Dec 12, 2024 6:39 pm
by alex.l

We need a full picture.
Am I right you keep store data in localStorage? Please show us how do you save data? How did you setup StateManager?

Please share runnable test case and steps to reproduce. It will help us to go forwards?


Re: filter is not working when pushing old state back to grid

Posted: Fri Dec 20, 2024 12:59 pm
by dsingh7

Hi Alex,

Please go through the video. I have applied filter on one dropdown column. then navigating to some other screen. then going back to same screen again.

So in back ground when filter applied I have stored grid state. and when user come back on the screen again then I push the saved state to grid again. This time grid is not loading row to grid but filter is persist. You can see the response in browser's network tab in video.

Grid Config

{
            appendTo: this.template.querySelector(".bryntum-container"),
            rowHeight: 37,
            maxHeight: 300,
            features: {
                search:true,
                cellEdit:false,
                autoHeight: false,
                filterBar:{
                    compactMode:false
                },
                stripe: true,
                columnReorder:true,
                group : false
            }
            store: bryntum.grid.Store({
                    fields: this.gridFields,
                    useLocaleSort: { sensitivity: "case" },
                    data: [],
                    listeners: {
                        filter: ({ filters }) => {
                            this.recordOffset = 0;
                            this.setFilterValue(filters);
                            sessionStorage.setItem("Grid-" + this.bryntumGridName, JSON.stringify(this.grid.state));
                        }
                    }
                }),
            columns: [{
                "text": "Madison Recommendation",
                "field": "madisonrecommendation",
                "filterable": {
                    "filterField": {
                        "items": [
                            "Key Contact - All",
                            "Key Contact - New",
                            "Key Contact - Upgraded",
                            "Opportunity - All",
                            "Opportunity - New",
                            "Opportunity - Downgraded"
                        ],
                        "multiSelect": true,
                        "type": "combo"
                    }
                }
            }],
            selectionMode: gd.selectionMode
        }
            

So first I am loading grid by using

this.grid = new bryntum.grid.Grid(gridConfig);

then pushing state

let state = sessionStorage.getItem("Grid-" + this.bryntumGridName);
this.grid.state = state;

then loading data

this.grid.store.data = this.data;

All configuration of column I have shared on previous comments. Please let me know if you need more information


Re: filter is not working when pushing old state back to grid

Posted: Fri Dec 20, 2024 1:17 pm
by ghulam.ghous

Thanks for the report, we have a ticket here to investigate this issue and fix it: https://github.com/bryntum/support/issues/10459


Re: filter is not working when pushing old state back to grid

Posted: Wed Jan 01, 2025 1:00 pm
by satya

Thanks Ghulam, any tentative eta on this please?


Re: filter is not working when pushing old state back to grid

Posted: Wed Jan 01, 2025 2:12 pm
by ghulam.ghous

Hey

No updates yet. Our most of the team is on vacations. They'll be back in the next week and hopefully someone get a chance to look at this one.


Re: filter is not working when pushing old state back to grid

Posted: Mon Jan 13, 2025 6:26 pm
by satya

Team, any ETA on resolution of this please


Re: filter is not working when pushing old state back to grid

Posted: Mon Jan 13, 2025 6:44 pm
by marcio

Hey satya,

Unfortunately, there is no ETA for now, I added a note to the ticket.