Fix tree context menu on server-loaded branches

This commit is contained in:
nathan 2024-10-01 14:31:05 -06:00
parent 2c196d3419
commit 1e277b2460
2 changed files with 21 additions and 2 deletions

View File

@ -67,11 +67,30 @@ export class EgwDragDropShoelaceTree extends egwActionObjectInterface{
{
return;
}
if(this.stateChangeContext)
{
const target = this.tree.shadowRoot.querySelector("[id='" + this.stateChangeContext.id + "']");
// Just set the attribute, we're not changing the tree value
// The selected attribute will be reset by the tree next render()
if(target && egwBitIsSet(_state, EGW_AO_STATE_SELECTED))
{
target.setAttribute("selected", "");
}
else if(target)
{
target.removeAttribute("selected");
}
if(target && egwBitIsSet(_state, EGW_AO_STATE_FOCUSED))
{
target.focus();
}
}
// Update the "focused" flag
if(egwBitIsSet(_state, EGW_AO_STATE_FOCUSED))
{
this.tree.focusItem(this.id);
this.tree.focus();
}
if(egwBitIsSet(_state, EGW_AO_STATE_SELECTED))
{

View File

@ -314,7 +314,7 @@ export class EgwPopupActionImplementation implements EgwActionImplementation {
event: e, posx: _xy.posx,
posy: _xy.posy,
innerText: nodeToUse?.title || _node.innerText,//nodeToUse only exists on widgets that define findActionTarget
target: nodeToUse?.target || _node,
target: nodeToUse || _node,
};
_callback.call(contextToUse || _context, _implContext, this);
}