Yes, it’s possible to implement a “Set as Default” button in the toolbar using the saveState and loadState APIs. Here’s the approach:
Save the selected state as a string
When the user clicks your “Set as Default” button, call saveState and save the returned string somewhere persistent—like local storage or your database. For example:
const defaultState = grid.saveState({ stringify: true });
localStorage.setItem('myGridDefaultState', defaultState);
Load this default state on page load
On page load, retrieve the saved state string and pass it to loadState:
const savedState = localStorage.getItem('myGridDefaultState');
if (savedState) {
grid.loadState({ state: savedState, refresh: true });
}