I want to show and hide these columns based on a value so i want some thing like this
hiddenColumns: {
if(myvalue ==1)
{
columns: [6,7],
}
indicators: false
},
so the columns should only hide if myvalue =1, otherwise it should always display
Thank you for your reply. Actually its not the cell value. I have a checkbox control outside the handsontable . Based on checkbox control value the columns will be shown or hidden. Also I have no idea of how updateSettings method work. Can you please provide a sample code. Thank you very much for your help in advance
ok so I was able to run this code and it works
Handsontable.dom.addEvent(autosave, 'change', function () {
var hot = $container.data('handsontable');
if (autosave.checked) {
hot.updateSettings({
hiddenColumns: {
columns: [0],
indicators: true
}
})
}
else {
hot.updateSettings({
hiddenColumns: {
columns: [0,6,7],
indicators: true
}
})
}
});
But the issue is that it only runs when we check and uncheck the checkbox. How can I run this code on the page load or when the handsontable loads. When the page loads the checkbox can be checked or unchecked so the above code should also work that time, but it only works when we click check or un check
what determines if the checkbox is checked or unchecked when table is being loaded? You have some internal logic for that, or user has its own settings?
ok I think I got it working. Thank you very much for your help. One last question. Once a checkbox is unchecked I want all values in the columns [0,6,7] to be updated as 1. All the values in the cells of columns [0,6,7] should be shown as 1.
If the columns aren’t editable you can use a renderer that will fake that the value is 1. However, if the data is editable you would need to clone the other values and load them again.
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