Set selected cell

Resolved
Accobat Development asked on November 20, 2023

Hello,
 
A big request we have from our users is Excel-like keyboard navigation - specifically tab to go to next column and enter to go to next row on input submission.
 
We have identified how to implement this and can get the next cell coordinates accurately. The only issue we face is setting the cell selection on FlexMonster, i.e. the highlight. From what we can read in the documentation, only removing a selection is supported, changing it to another cell is not.
 
Are we missing something? If not, we would like to request this feature. We assume it would be something like:
 
setSelectedCells(cells: CellData[])
 
Best regards,
Jonas

6 answers

Public
Maksym Diachenko Maksym Diachenko Flexmonster November 21, 2023

 
Hello, Jason!

Thank you for reaching out to us.

Please note that Flexmonster has the setSelectedCell(rowIndex,columnIndex) API call, which applies the selection on the cell based on the provided row and column indexes. You are welcome to check the JSFiddle example: https://jsfiddle.net/flexmonster/knmd52hs/

Also, we would like to know more about your use case to understand better whether this approach would be helpful. If needed, we can extend this method's functionality by allowing it to select multiple cells.

Looking forward to hearing from you.

Best Regards,
Maksym

Public
Accobat Development November 22, 2023

Hello Maksym,
 
Thank you for your help! I don't have the opportunity to test this right now, but given your jsFiddle it actually looks exactly like what we need. In essence, we just want to extend keyboard navigation such that it is just a little bit more like Excel. Part of this is that the TAB button selects the cell one columnIndex + 1, and the ENTER button (on submit) sets the selected cell to rowIndex + 1.
 
I had imagined I would just do it by listening for these input, getting the currently selected cell and then setting the selected cell to that of the same coordinates, with either row or columnIndex iterated.
 
As a separate note, I did have a look at the documentation and it seems that setSelectedCell(rowIndex,columnIndex) is missing from the documentation. I can't find any reference to it except for this which lists it as a removed function. I would imagine it would have a documentation page similar to this (it would make sense for this function to be "related" to getSelectedCell() and removeSelection() )
 
Either way, we are super thankful for your help! 🙂 Given that we can't test this feature right now, I will consider this matter solved. We will attempt implementation within the next month and report back here if we encounter issues.
 
Br
Jonas

Public
Accobat Development November 22, 2023

Hello again - I just tried a quick test with it because I was excited. setSelectedCell() does not appear to be a function in our installation of FlexMonster. We are on 2.9.63. Are we certain that the function is available on the live version of FlexMonster? The 2.2 -> 2.3 migration guide does list it as a removed method, after all.
 
Br
Jonas

Public
Maksym Diachenko Maksym Diachenko Flexmonster November 23, 2023

Hello, Jonas!

Thank you for your feedback.

As you have mentioned, this method is removed from the documentation, but it works in terms of backward compatibility with previous versions. So you can use it in the same way as in this JSFiddle: https://jsfiddle.net/flexmonster/knmd52hs/
The only difference is if you use types from flexmonster.d.ts while working in a TypeScript environment, you need to cast the Flexmonster object to type any before using the setSelectedCell API call:

(flexmonster as any).setSelectedCell(3,3);

Please let us know if our answer was helpful.

Best Regards,
Maksym

Public
Accobat Development November 24, 2023

Hello Maksym,
 
Thank you. This works fine! 🙂
 
Do you guys have a list of methods from previous versions that are still backwards compatible but perhaps not listed in the documentation? This function opens up a lot of cool possibilities for us that we would not have identified otherwise. I'm curious to see if this may be the case with other functions.
 
Br
Jonas

Public
Maksym Diachenko Maksym Diachenko Flexmonster November 24, 2023

Hello, Jonas!

Thank you for your reply.
We are glad to hear that the recommended solution worked for you. Kindly note that we do not have the list containing undocumented API calls. You may find them by looking for deprecated methods in our migration guides between different versions. 

Best Regards.
Maksym

Please login or Register to Submit Answer