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) {
console.log(1)
return;
}
var nodeData = self.gojs_nodeData.data;
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 (ret.data.length > 0) {
('#dview_jqgrid').dview_jqgrid({ classId: nodeData.clsId, dataId: nodeData.dataId, itemcode: nodeData.itemCode, BOMname: nodeData.BOMname, name: nodeData.name, view: true }).dview_jqgrid('show'); } else { var d = dialog({ content: '此物料没有子BOM' }); d.show(); (’.ui-popup’).css(‘z-index’, ‘1040’)
setTimeout(function () {
d.close().remove();
}, 1000);
}
} else {
var d = dialog({
title: ’ ’ + ‘提示’,
content: ret.msg
});
d.show();
self.options.onError(ret);
}
},
error: function () {
}
});
} else if (event.keyCode == “79”) {
self.gojs_open(self.gojs_nodeData);
setTimeout(function () {
self.dview_ele.find(‘a.open>p’).trigger(“click”);
}, 2000);
}
self.gojs_nodeData = null;
event.stopPropagation();
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:

    myDiagram.focus();

Thanks very much