Is it possible to save tableView “state” to the layout on layout save?
For example we would like to save the:
- columns sorted by
- “filter”
- colorised cells
- etc.?
Is it possible to save tableView “state” to the layout on layout save?
For example we would like to save the:
All of these are quite different:
We’ve just added these three events to let the developer control what is being saved as part of the layout, and intercept the application of the layout. Note that when handling the onViewLayoutGenerated and onViewLayoutApplying, it’s possible to change the layout by assigning the layout.viewState field.
// open a table, then do View | Layout | Clone to see what's happening
function info(action, layout) { grok.shell.info(`${action}: ${layout.viewState}`); }
grok.events.onViewLayoutGenerated.subscribe((layout) => info('generated', layout));
grok.events.onViewLayoutApplying.subscribe((layout) => info('applying', layout));
grok.events.onViewLayoutApplied.subscribe((layout) => info('applied', layout));
Next to come: a field for storing the additional (app-specific, etc) information.
Thanks for providing these events. Am I right we could use the property API to save arbitrary data to the a layout and use this information later, right?
In any case, what are the limitations of the property API? In the past I was running into some issues when I was trying to save non-string data to the property API?
Properties API currently supports only string data.
But you can save additional information to ViewLayout.userData field (serialized to string).
NOTE: This field can be renamed in the future, we will notify you.