zambezi / grid

D3 component for drawing grids
MIT License
4 stars 2 forks source link

Dispatch "settings-changed" whenever column configuration has changed #28

Closed gabrielmontagne closed 7 years ago

gabrielmontagne commented 7 years ago

Description

With this PR, the grid dispatches settings-changed whenever the settings change. For now, these "settings" are column configuration changes: column order, column sorting, and column width.

But any component can dispatch the event itself through the DOM if needed.

Motivation and Context

The purpose of this change is to allow a central handler for serializing whatever settings are needed (per application) for persistence purposes.

How Was This Tested?

This has been tested on the provided settings-changed-events rig in the examples folder.

Types of changes

Checklist:

gabrielmontagne commented 7 years ago

Thanks @cristiano-belloni , in general I agree.

But in this case I don't think this is something that will need tuning or that affects the performance of the grid. That 300 is just "a bit of debounce" before dispatching the save settings event.

As I was chatting with you earlier "offline", instead of surfacing up as config, I would, if I could without it being too awkward, hide it further down, debounce(whatever, 300) => waitATinyBit(whatever)

I moved it up to a constant at the top of the file, but it looked (to my jaded withered eyes) as a bit artificial and ceremonious. I'll merge it in like this. Feel free to insist, tho! : )