Our blazing fast Grid component built with pure JavaScript


Post by Jerther »

Hi!

I'm trying to save and load the grid columns visibility, width and order. I found only one function (no event) related to this and it's the column picker's https://www.bryntum.com/docs/gantt/#Grid/feature/ColumnPicker#function-onColumnToggle

(By the way the documentation is a bit weird, with "The" as parameter, and missing words in the description)

I tried to configure it this way:

new Gantt({
    adopt : document.body,
    columns : [
        { type : 'name', field : 'name', width : 250 },
        { type : 'startdate' },
        { type : 'duration' },
    ],
    features: {
        columnPicker: {
            onColumnToggle() { console.debug('Column toggled'); }
        }
...

With this, when I right click the header and toggle a column visibility, I do get the event, but the column does not actually toggle anymore.

Is there a known way of properly saving and loading those columns configuration?

Thanks!


Post by mats »

onColumnToggle is a private method, don't use it. If you want to save state, this demo should be of interest: https://bryntum.com/examples/grid/state/

Docs:
https://bryntum.com/docs/gantt/#Grid/view/mixin/GridState

Tired of debugging javascript errors in web applications? Try our powerful error logging service RootCause


Post by Jerther »

Wow, that's way easier :D Thanks!

Now is there an event that triggers when any property of the grid state changes, so I could automatically save it?


Post by mats »

We're most likely adding such an event in the coming months, but no such event exists at this moment.

Tired of debugging javascript errors in web applications? Try our powerful error logging service RootCause


Post by Jerther »

Ok I'll find a workaround until then.

Thanks Mats!


Post by mats »

Tired of debugging javascript errors in web applications? Try our powerful error logging service RootCause


Post by glcark »

Have there been any updates to this? Looking to have the state automatically saved when changes are made.


Post by mats »

No update yet but I have marked this ticket as a high prio now so we should get to it soon. Thanks for checking in!

Tired of debugging javascript errors in web applications? Try our powerful error logging service RootCause


Post by npzi »

Is there a workaround until the event is implemented? I would not like to add buttons to save and load the configuration.


Post by alex.l »

All the best,
Alex


Post Reply