How to remember/save Column Order, Readonly, Width...for next visit

Tags: #<Tag:0x00007f51c1c6e688>

Hi,

My user changes the order of column, remove certain column, change the width of certain column for his/her preference. and I need to save their personal settings, so that handsontable can remember and display their settings for their next visit of the applicaiton

Can you please guide me how?

Thanks,

Hi @tschoi7

you need to use callback after action.

afterColumnMove for column moving,
afterColumnResize for reasing columns,
afterRemoveCol if column is removed

If you would have any issues with the above callbacks let me know.

thanks aleksandra,

I need to get the list of visible column names(or title) in the order, but afterColumnMove function has oldIndex, newIndex only,
Could you please tell me how I can read?

I just found out I can use hot.getColHeader() to get the list of column headers in the visible order.

now, would appreciate if you could teach me how to get the each columns’ width, so that i can save it to cookie, and set when user’s next visit…

Thanks,

There is a getColWidths() and an options.colWidths[] to get/set column widths. And you save to cookies via JavaScript document.cookie.