Hey, I am sorry if this is a stupid question. I am having a hard time understanding how I can set default configuration options globally within my project for all instances of handsontable.
What I am trying to set,
imeFastEdit: true
What I have tried so far,
- Directly changed the default in handsontable.js => did not work
- Set it alongside my definition in individual instances => worked
- Set it in a common.js script to overwrite the default
Here is what I tried doing in approach 3,
Handsontable.hooks.add('afterInit', function () { console.log("hot", this); if (typeof Handsontable !== 'undefined') { Handsontable.DefaultSettings = Object.assign({}, Handsontable.DefaultSettings, { imeFastEdit: true, licenseKey: 'non-commercial-and-evaluation' }); console.log('Handsontable library is loaded', Handsontable); } else { console.error('Handsontable library is not loaded'); } });
In the above snippet, the weird part is it sets the imeFastEdit (and licenseKey for faster debugging if it works or not) but it still does not work. What I mean is the console.log will still show the alert saying license key is not set and the imeFastEdit wont work
For reference here is my example definition,
hot = new Handsontable(container, { //licenseKey: 'non-commercial-and-evaluation', data: data, themeName: 'ht-theme-horizon', language: 'ja-JP', manualRowResize: true, rowHeaders: true, rowHeights: 50, className: 'htMiddle', renderer: detailRenderer, //imeFastEdit: true, fillHandle: false, preventScrolling: false, hiddenColumns: {columns: [0,9,10,11,12, 13, 14, 15, 16, 17, 18, 20, 21]}, filters: true, dropdownMenu: ['filter_by_condition', 'filter_by_value', 'filter_action_bar'], columns: [・・・], manualColumnResize: true, manualRowResize: true, renderAllRows:true, stretchH: 'all', afterChange: getChangedRows, afterGetRowHeader: function(col, TH) { TH.className = 'htMiddle' }, cells: function (row, col) { var cellProperties = {}; cellProperties.renderer = detailRenderer; return cellProperties; } });
Other ways I tried for approach 3 are:
Handsontable.hooks.add('afterInit', function () { if (typeof this.getSettings().imeFastEdit === "undefined") { this.updateSettings({ imeFastEdit: true }); console.log("imeFastEdit has been set to true for instance:", this); } }); Handsontable.hooks.add('afterInit', function () { this.imeFastEdit = true; console.log("imeFastEdit is set to true for instance:", this); });
These did not work as well.
I am quite confused as to what the issue is that is causing it to not work properly, if it is something with the way I am defining it or maybe in the syntax itself?
Any help is appreciated, thanks