Sometimes the Arrow Keys cease to function in the Dropdown control within a Datagrid.
To Reproduce
Steps to reproduce the behaviour:-
Expected behavior
The arrow keys should move up and down within the dropdown control
Version
v4.31.2
Suggested fix
in setActiveCell function
the check
if (!$('input, button:not(.btn-secondary, ...
should be changed to
if (!$('input, select, button:not(.btn-secondary,...
I guess this is because you set focus on the cell but the list is already open. Can you elaborate on the suggested fix? Are you saying it just just ignore setActive cell when a list is open?
If so you could also like not call setActiveCell when the list is open?
We are backend driven and there is nothing that our front end can do. We need to put the focus back into the grid which has lost focus.
If the function is checking/handling 'input', can it not do the same for 'select'? The fix works very well for us BTW
Ok but the fix line seems incomplete? Just add select? And then if i do does it still focus the grid?
The following block in datagrid.js (at line 1035 at time of writing)
if ((!$('input, button:not(.btn-secondary, .row-btn, .datagrid-expand-btn, .datagrid-drilldown, .btn-icon)', self.activeCell.node).length) || (self.activeCell.node.is('.has-btn-actions') && self.activeCell.node.find('.btn-actions').length)) {
self.activeCell.node.focus();
if (isGroupRow) {
self.activeCell.groupNode = self.activeCell.node;
}
}
should read
if ((!$('input, select, button:not(.btn-secondary, .row-btn, .datagrid-expand-btn, .datagrid-drilldown, .btn-icon)', self.activeCell.node).length) || (self.activeCell.node.is('.has-btn-actions') && self.activeCell.node.find('.btn-actions').length)) {
self.activeCell.node.focus();
if (isGroupRow) {
self.activeCell.groupNode = self.activeCell.node;
}
}
This prevents the cell from stealing focus if the dropdown is present and setActiveCell is called again.
ok, i'll add this then...
Hi @tmcconechy, the up&down arrow is now working in https://master-enterprise.demo.design.infor.com/components/datagrid/example-editable.html?theme=uplift&variant=light&colors=0066D4.
However, when I try this in console, $('#datagrid').data('datagrid').setActiveCell(0, 9) it went Undefined.
may I know if this is also expected?
Yes, thats correct in this case. The function isnt returning any value.
This issue is now resolved.
Most helpful comment
ok, i'll add this then...