Hi,
I need to dynamically change the values in a dropdown column based on some user action. As you can see in my column definition, the Project_name field is of dropdown type and the source is an array (this.projectDropdown). However, even if i change the elements in my array, the same is not reflected in the dropdown. Could you please help me on how i can reload the dropdown with a different set of data elements?
I tried render() and updateSettings(), but it did not help.
// My column definition. The grid have 60+ columns, added only few below for reference.
Cols = [{data:’’,readOnly:true,colWidths:50},
{data: ‘resource_name’, readOnly:true, colWidths:150},
{data: ‘resource_type’, readOnly:true},
{data: ‘project_name’,readOnly:true, type: ‘autocomplete’, strict:true, allowInvalid:false, trimDropdown: false, source:this.projectDropDown,colWidths:230},
{data: ‘project_manager’, readOnly:true, colWidths:100},
{data: ‘week_1’, type:‘numeric’,allowInvalid:false},
{data: ‘week_2’, type:‘numeric’,allowInvalid:false},
{data: ‘week_3’, type:‘numeric’,allowInvalid:false},
{data: ‘week_4’, type:‘numeric’,allowInvalid:false},
{data: ‘m_1’, type:‘numeric’,allowInvalid:false},
hotSettings: Handsontable.GridSettings = {
columns:this.Cols,
minCols:65,
width: ‘100%’,
fixedColumnsLeft: 5,
colHeaders: [ ‘Action’, ‘Resource Name’,‘Type’,‘Project/Demand/Admin Task’,‘Manager’, ‘Wk1’,‘Wk2’, ‘Wk3’, ‘Wk4’, ‘MAY’, ‘Wk1’,‘Wk2’, ‘Wk3’, ‘Wk4’, ‘JUN’, ‘Wk1’,‘Wk2’, ‘Wk3’, ‘Wk4’, ‘Wk5’, ‘JUL’, ‘Wk1’,‘Wk2’, ‘Wk3’, ‘Wk4’, ‘AUG’, ‘Wk1’,‘Wk2’, ‘Wk3’, ‘Wk4’, ‘SEP’, ‘Wk1’,‘Wk2’, ‘Wk3’, ‘Wk4’, ‘Wk5’, ‘OCT’, ‘Wk1’,‘Wk2’, ‘Wk3’, ‘Wk4’, ‘NOV’, ‘Wk1’,‘Wk2’, ‘Wk3’, ‘Wk4’, ‘DEC’, ‘Wk1’,‘Wk2’, ‘Wk3’, ‘Wk4’, ‘Wk5’, ‘JAN’, ‘Wk1’,‘Wk2’, ‘Wk3’, ‘Wk4’, ‘FEB’, ‘Wk1’,‘Wk2’, ‘Wk3’, ‘Wk4’, ‘MAR’, ‘Wk1’,‘Wk2’, ‘Wk3’, ‘Wk4’, ‘Wk5’, ‘APR’ ],
};
Please find the code snippet for UpdateSettings() below,
// reset the source array and fill with new elements
this.projectDropDown = [{}] ;
this.projectDropDown.push("--mySelect--") ;
this.projectDropDown.push("My proj");
hotInstance.updateSettings({
columns: this.Cols,
undo:false,
});
hotInstance.render()
Appreciate your help!
Regards
Prasanth