Hi, I used handsontable since a few years. I had to adopt the width of the dropdown menu where I used your suggested solution from here:
But after an update to a current handsontable version, this is not working anymore. I also couldn’t find any documentation about it.
Is there any way how to adjust the dropdown menu width in handsontable 12/13?
Hi @stephan.tanner
Thank you for contacting us. I tried the old solution with the newest version of Handsontable, and it seems to be working fine:
https://jsfiddle.net/handsoncode/87x4oguL/
Can you please confirm if that’s your expected output?
The problem is that I use Angular 15 with strict type checking and it complains that DropdownMenu does not have a field “menu”.
I casted it to “any” and that seems to work. It’ a bit cumbersome. imho, the Angular wrappers should have better type definitions
For the record, this is my current solution:
Handsontable.hooks.add('modifyColWidth', function (width) {
const dropdownMenuPlugin: DropdownMenu = thisHot.getPlugin('dropdownMenu');
const x: any = (dropdownMenuPlugin as any).menu;
if (this === x.hotMenu) {
return 400;
}
return width;
});
@stephan.tanner
I see. Thank you for sharing your solution. We are improving the types in our wrappers whenever we can, so I hope it will be fixed in the nearest future. For the time being I think that casted it to ‘any’ is the best workaround.
The good news is that we also want to implement a more user friendly way of customizing the table’s look, so doing such hacks won’t even be needed.