when using a declarative `tbar` when instantiating a ContentView,
it is a reference and gets pushed into every time.
instead, copy the given tbar into a local variable and use that
this fixes an issue that we push the same components (e.g. search) into
the toolbar whenever we open a view with a new ContentView
(when using declarative tbar)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Proxmox.Utils.monStoreErrors(me, store);
- if (!me.tbar) {
- me.tbar = [];
- }
+ let tbar = me.tbar ? [...me.tbar] : [];
if (me.useUploadButton) {
- me.tbar.unshift(
+ tbar.unshift(
{
xtype: 'button',
text: gettext('Upload'),
);
}
if (!me.useCustomRemoveButton) {
- me.tbar.push({
+ tbar.push({
xtype: 'proxmoxStdRemoveButton',
selModel: sm,
enableFn: rec => !rec?.data?.protected,
baseurl: baseurl + '/',
});
}
- me.tbar.push(
+ tbar.push(
'->',
gettext('Search') + ':',
' ',
Ext.apply(me, {
store,
selModel: sm,
- tbar: me.tbar,
+ tbar,
columns,
listeners: {
activate: reload,