Show/Hide Handsontable columns based on a value

Actually what I need is that when the columns are hidden the values should always be 1.And when they are visible again it should show their previous values. The previous value comes from the database table and is permanent.They only change when a “save” button is pressed