I have a dropdown list and select of the option I have updated the table data and show/hide some col based on condition the first time it’s working but not always.
UpdateSetting for HiddenColumn not working
Hi @anil
do we have any updates on the issue, or is it already solved? Any demo (as @adrian.szymanski mentioned) would help us a lot.
Hey
Sorry for the delay -
I have added some examples-
Handsontable lib version 8.3.1, license
function onSelectChange(hotInstance) {
let isEnable = true; // This value is updated via some condition.
const hideColums = isEnable ? [2,3,4] : []; // If condition match then only hide or show the col.
const rowData = [{name: 'jack',last: 'me',number:'23823',add:'some add'},{name: 'Anil',last: 'Yadav',number:'23823',add:'some add'},{name: 'No',last: 'Ja',number:'23823',add:'some add'}];
const TableHeader = [{data: name,label:'First Name'},{data: last,label:'Last Name'},{data: number,label:'Number'},{data: add,label:'Address details'}];
hotInstance.updateSettings({
rowHeaders: false,
data: tableData,
//Set readonly true to all cell
readOnly: true,
//Warping
wordWrap: true,
autoWrapCol: true,
width: '100%',
//height: 200,
rowHeights: 10,
columnHeaderHeight: 35,
filters: false,
dropdownMenu: false,
hiddenColumns: true,
hiddenColumns: {
columns: hideColums,
},
//Use this for update to indivudual column
columns: TableHeader,
});
}
//Some drop-down /select option events.
$('dropDown').on('change',function(){
onSelectChange(hotInstance);
})
Hi @anil
There are some missing parts in the code you send and I can’t reproduce it. Can you please prepare a demo here?
Thanks I found an alternative way to fix the issue.