FredS
January 15, 2019, 9:36pm
#1
I have enabled keyboard navigation:
gantt.config.keyboard_navigation_cells = true;
Selecting a task is simple, just use
gantt.selectTask(id);
But now I would need to programmatically select a cell in the grid. I couldn’t find anything in the documentation for this, any ideas?
ramil
January 16, 2019, 12:13pm
#2
Hello Frederik,
You can use the following command to change the focus:
gantt.ext.keyboardNavigation.focus{type:"taskCell", id:"task id", column:"column name"}
But that will work only if the focus is already on the Grid. You need to use a delay to after changing the focus.
The following example shows how it might work:
http://snippet.dhtmlx.com/689d096b7
We’ll update the following article and mention that it is possible to specify the task cell in the focus()
method:
https://docs.dhtmlx.com/gantt/api__gantt_ext_other.html
FredS
January 16, 2019, 12:35pm
#3
Very nice, thanks.
And sorry, I didn’t realize that I also needed a way to get the currently selected column. Is that also possible?
ramil
January 17, 2019, 2:18pm
#4
Hello Fredrik:
There is no built-in method in the current version, but it will be added in the next version (6.1).
Now, you can use the internal method to get the current active cell:
gantt.$keyboardNavigation.dispatcher.getActiveNode()
Here is the snippet:
http://snippet.dhtmlx.com/e9a32b720
ramil
March 4, 2019, 3:50pm
#6
Hello Fredrik,
The dev team implemented a new function that returns the active cell:
gantt.ext.keyboardNavigation.getActiveNode()
Here is an example:
http://snippet.dhtmlx.com/a889c6e9c
Unfortunately, the documentation doesn’t mention that change, but we will add it in the future.
2 Likes