ui: navigation tree: fix losing datastore selection on store load
instead of using 'replaceChild', simply set the appropriate properties. When using the 'nodeUpdate' (protected function of extjs, intended to be overwritten) instead of the private 'updateNode', it will be called when the properties change This way, the treenode stays the same and it can keep the selection Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
8ca7cccf5f
commit
c7d42dac97
|
@ -130,9 +130,10 @@ Ext.define('PBS.store.NavigationStore', {
|
||||||
Ext.define('CustomTreeListItem', {
|
Ext.define('CustomTreeListItem', {
|
||||||
extend: 'Ext.list.TreeItem',
|
extend: 'Ext.list.TreeItem',
|
||||||
xtype: 'qtiptreelistitem',
|
xtype: 'qtiptreelistitem',
|
||||||
updateNode: function(node, oldNode) {
|
|
||||||
|
nodeUpdate: function(node, modifiedFieldNames) {
|
||||||
|
this.callParent(arguments);
|
||||||
const qtip = node ? node.get('qtip') : null;
|
const qtip = node ? node.get('qtip') : null;
|
||||||
this.callParent([node, oldNode]);
|
|
||||||
if (qtip) {
|
if (qtip) {
|
||||||
this.element.dom.setAttribute('data-qtip', qtip);
|
this.element.dom.setAttribute('data-qtip', qtip);
|
||||||
} else {
|
} else {
|
||||||
|
@ -261,17 +262,18 @@ Ext.define('PBS.view.main.NavigationTree', {
|
||||||
iconCls = 'fa fa-database pmx-tree-icon-custom maintenance';
|
iconCls = 'fa fa-database pmx-tree-icon-custom maintenance';
|
||||||
}
|
}
|
||||||
|
|
||||||
const child = {
|
if (getChildTextAt(j).localeCompare(name) !== 0) {
|
||||||
|
list.insertChild(j, {
|
||||||
text: name,
|
text: name,
|
||||||
qtip,
|
qtip,
|
||||||
path: `DataStore-${name}`,
|
path: `DataStore-${name}`,
|
||||||
iconCls,
|
iconCls,
|
||||||
leaf: true,
|
leaf: true,
|
||||||
};
|
});
|
||||||
if (getChildTextAt(j).localeCompare(name) !== 0) {
|
|
||||||
list.insertChild(j, child);
|
|
||||||
} else {
|
} else {
|
||||||
list.replaceChild(child, list.getChildAt(j));
|
let oldChild = list.getChildAt(j);
|
||||||
|
oldChild.set('qtip', qtip);
|
||||||
|
oldChild.set('iconCls', iconCls);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue