do not rerender row actions if opened

This commit is contained in:
Yuri Kuznetsov
2024-11-06 15:37:14 +02:00
parent 0f127091c2
commit f0cdd1866b
3 changed files with 21 additions and 3 deletions
+1 -2
View File
@@ -78,8 +78,7 @@ class NoteCollection extends Collection {
return;
}
model.set(item, {keepRowActions: true});
model.set(item);
});
}
@@ -52,6 +52,12 @@ class DefaultRowActionsView extends View {
template = 'record/row-actions/default'
/**
* @private
* @type {boolean}
*/
menuIsShown = false
setup() {
this.options.acl = this.options.acl || {};
this.scope = this.options.scope || this.model.entityType;
@@ -69,11 +75,19 @@ class DefaultRowActionsView extends View {
return;
}
if (this.menuIsShown) {
this.once('menu-hidden', () => this.reRender());
return;
}
this.reRender();
});
}
afterRender() {
this.menuIsShown = false;
const $dd = this.$el.find('button[data-toggle="dropdown"]').parent();
let isChecked = false;
@@ -88,12 +102,17 @@ class DefaultRowActionsView extends View {
}
$el.addClass('active');
this.menuIsShown = true;
});
$dd.on('hide.bs.dropdown', () => {
if (!isChecked) {
this.$el.closest('.list-row').removeClass('active');
}
this.menuIsShown = false;
this.trigger('menu-hidden');
});
}
+1 -1
View File
@@ -338,7 +338,7 @@ class PanelStreamView extends RelationshipPanelView {
const model = this.collection.get(data.noteId);
if (model) {
model.fetch({keepRowActions: true})
model.fetch()
.then(() => this.syncPinnedModel(model, true));
}