I have a split feature in my app I can open two modules. If I open handsontable in down and up another module.
By default when I open filterdropdown by clicking header arrow button I can not see ok button of filter drop down.
My hot table and dropdown looks line below.
I want to move drop down a bit up. i tried in below ways but it is not working. It is going to infifnite loop.
- In befioreDropDownShow and AfterDropDownShow I tried to re posistion in this way.
const onAfterCellMouseDown = React.useCallback(
(event: MouseEvent, coords: Handsontable.CellCoords) => {
if (coords.row !== -1) {
return;
}
const clientY = event.clientY;
const clientX = event.clientX;
const hot = hotRef.current.hotInstance;
clientXRef.current = clientX;
clientYref.current = clientY;
colRef.current = coords.col;
},
[hotRef],
);
const onAfterDropDownMenuShow = React.useCallback(
(DropdownMenu) => {
const hot = hotRef.current.hotInstance;
const drpDwn = hot?.getPlugin(‘dropdownMenu’) as any;
hot.selectCell(0, colRef.current);
drpDwn.open({
top: clientYref.current - 80,
left: clientXRef.current,
});
},
[hotRef],
);
- I also tried to get elemnt by class name and changing the top but even that did not worked. When I did this in the chrome debugger it worked. document.getElementsByClassName(‘htDropdownMenu’)[0]
Can anyone help me to resolve this challenge.
If I comment this line hot.selectCell(0, colRef.current); in onAfterDropDownMenuShow it is not going to infinite loop but filter dropdown is not showing.
I am thinking the issue is by default dropdown is opening and I am tryign to open again or select cell is doing two times that is the reason for infinite loop.
By default when dropdown is opened I need to position a bit top.
<HotTable
ref={hotRef}
rowHeaders={false}
colHeaders={columnHeaders}
colWidths={220}
manualColumnResize={true}
fixedColumnsStart={1}
settings={cloneDeep(tableSettings)}
afterOnCellMouseDown={onAfterCellMouseDown}
afterDropdownMenuShow={onAfterDropDownMenuShow}
columnSorting
height=‘100%’
width=‘100%’
dropdownMenu={[
‘filter_by_condition’,
‘filter_operators’,
‘filter_by_condition2’,
‘filter_by_value’,
‘filter_action_bar’,
]}
filters
licenseKey=‘non-commercial-and-evaluation’
search
/>