How to select the focus of the node?

How do I get the focus of the selected node?

If I want to click on a node
Keyboard event that triggers it
The realization of a function such as a pop-up window, click when I close the window, while the node is selected, but the focus has not, I can no longer trigger keyboard events, need to click on the node again can access node, please help. Thank you!

The last picture cannot trigger the keyboard event because the focus is not available

self.dview_ele.find(’#myDiagramDiv_’ + self.index).on(‘keyup’, ’ canvas’, function (event) {
if (self.gojs_nodeData == null) {
var nodeData =;
if (event.keyCode == “73”) {
('#dv_browse_state_attr').browse_state_attr({ classId: nodeData.clsId, dataId: nodeData.dataId, itemcode: nodeData.itemCode, view: true }).browse_state_attr('show'); } else if (event.keyCode == "80") { .ajax({
url: openinfo.root + “data/GetBomGetList”,
type: “POST”,
data: { Bomitemcode: nodeData.itemCode, BomType: nodeData.BOMname },
dataType: “json”,
success: function (ret) {
if (ret.code == “00000”) {
if ( > 0) {
('#dview_jqgrid').dview_jqgrid({ classId: nodeData.clsId, dataId: nodeData.dataId, itemcode: nodeData.itemCode, BOMname: nodeData.BOMname, name:, view: true }).dview_jqgrid('show'); } else { var d = dialog({ content: '此物料没有子BOM' });; (’.ui-popup’).css(‘z-index’, ‘1040’)
setTimeout(function () {
}, 1000);
} else {
var d = dialog({
title: ’ ’ + ‘提示’,
content: ret.msg
error: function () {
} else if (event.keyCode == “79”) {
setTimeout(function () {
}, 2000);
self.gojs_nodeData = null;
return false;

I want to get the focus of the selected node

Call Diagram.focus when you hide or remove HTML elements that had focus.

How to call? Is there an example?

What do you mean by “How to call?”? That method takes no arguments and returns no value, so there really isn’t any choice in how to call it. For example:


Thanks very much