Fix changing dataview items

This commit is contained in:
Julia Radzhabova 2021-07-21 21:05:42 +03:00
parent 4c67f91240
commit f142cfb697
4 changed files with 66 additions and 54 deletions

View file

@ -126,7 +126,7 @@ define([
me.template = me.options.template || me.template;
me.listenTo(me.model, 'change', me.render);
me.listenTo(me.model, 'change', this.model.get('skipRenderOnChange') ? me.onChange : me.render);
me.listenTo(me.model, 'change:selected', me.onSelectChange);
me.listenTo(me.model, 'remove', me.remove);
},
@ -185,6 +185,18 @@ define([
onSelectChange: function(model, selected) {
this.trigger('select', this, model, selected);
},
onChange: function () {
if (_.isUndefined(this.model.id))
return this;
var el = this.$el || $(this.el);
el.toggleClass('selected', this.model.get('selected') && this.model.get('allowSelected'));
el.toggleClass('disabled', !!this.model.get('disabled'));
this.trigger('change', this, this.model);
return this;
}
});

View file

@ -1873,15 +1873,15 @@ define([
restoreHeight: 138,
allowScrollbar: false,
store: new Common.UI.DataViewStore([
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: -1}},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 1}},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 2}},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 3}},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 4}},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 5}},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 6}},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 7}},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 8}}
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: -1}, skipRenderOnChange: true},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 1}, skipRenderOnChange: true},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 2}, skipRenderOnChange: true},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 3}, skipRenderOnChange: true},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 4}, skipRenderOnChange: true},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 5}, skipRenderOnChange: true},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 6}, skipRenderOnChange: true},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 7}, skipRenderOnChange: true},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 8}, skipRenderOnChange: true}
]),
itemTemplate: _.template('<div id="<%= id %>" class="item-markerlist"></div>')
});
@ -1894,14 +1894,14 @@ define([
restoreHeight: 92,
allowScrollbar: false,
store: new Common.UI.DataViewStore([
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: -1}},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 4}},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 5}},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 6}},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 1}},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 2}},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 3}},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 7}}
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: -1}, skipRenderOnChange: true},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 4}, skipRenderOnChange: true},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 5}, skipRenderOnChange: true},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 6}, skipRenderOnChange: true},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 1}, skipRenderOnChange: true},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 2}, skipRenderOnChange: true},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 3}, skipRenderOnChange: true},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 7}, skipRenderOnChange: true}
]),
itemTemplate: _.template('<div id="<%= id %>" class="item-multilevellist"></div>')
});
@ -1914,10 +1914,10 @@ define([
restoreHeight: 92,
allowScrollbar: false,
store: new Common.UI.DataViewStore([
{id: 'id-multilevels-' + Common.UI.getId(), data: {type: 2, subtype: -1}},
{id: 'id-multilevels-' + Common.UI.getId(), data: {type: 2, subtype: 1}},
{id: 'id-multilevels-' + Common.UI.getId(), data: {type: 2, subtype: 2}},
{id: 'id-multilevels-' + Common.UI.getId(), data: {type: 2, subtype: 3}}
{id: 'id-multilevels-' + Common.UI.getId(), data: {type: 2, subtype: -1}, skipRenderOnChange: true},
{id: 'id-multilevels-' + Common.UI.getId(), data: {type: 2, subtype: 1}, skipRenderOnChange: true},
{id: 'id-multilevels-' + Common.UI.getId(), data: {type: 2, subtype: 2}, skipRenderOnChange: true},
{id: 'id-multilevels-' + Common.UI.getId(), data: {type: 2, subtype: 3}, skipRenderOnChange: true}
]),
itemTemplate: _.template('<div id="<%= id %>" class="item-multilevellist"></div>')
});

View file

@ -1304,15 +1304,15 @@ define([
restoreHeight: 138,
allowScrollbar: false,
store: new Common.UI.DataViewStore([
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: -1}},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 1}},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 2}},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 3}},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 4}},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 5}},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 6}},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 7}},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 8}}
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: -1}, skipRenderOnChange: true},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 1}, skipRenderOnChange: true},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 2}, skipRenderOnChange: true},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 3}, skipRenderOnChange: true},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 4}, skipRenderOnChange: true},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 5}, skipRenderOnChange: true},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 6}, skipRenderOnChange: true},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 7}, skipRenderOnChange: true},
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 8}, skipRenderOnChange: true}
]),
itemTemplate: _.template('<div id="<%= id %>" class="item-markerlist"></div>')
});
@ -1325,14 +1325,14 @@ define([
restoreHeight: 92,
allowScrollbar: false,
store: new Common.UI.DataViewStore([
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: -1}},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 4}},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 5}},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 6}},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 1}},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 2}},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 3}},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 7}}
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: -1}, skipRenderOnChange: true},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 4}, skipRenderOnChange: true},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 5}, skipRenderOnChange: true},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 6}, skipRenderOnChange: true},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 1}, skipRenderOnChange: true},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 2}, skipRenderOnChange: true},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 3}, skipRenderOnChange: true},
{id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 7}, skipRenderOnChange: true}
]),
itemTemplate: _.template('<div id="<%= id %>" class="item-multilevellist"></div>')
});

View file

@ -946,21 +946,21 @@ define([
me.paraBulletsPicker = {
conf: {rec: null},
store : new Common.UI.DataViewStore([
{group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 1},
{group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 2},
{group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 3},
{group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 4},
{group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 5},
{group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 6},
{group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 7},
{group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 8},
{group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 4},
{group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 5},
{group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 6},
{group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 1},
{group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 2},
{group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 3},
{group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 7}
{group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 1, skipRenderOnChange: true},
{group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 2, skipRenderOnChange: true},
{group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 3, skipRenderOnChange: true},
{group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 4, skipRenderOnChange: true},
{group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 5, skipRenderOnChange: true},
{group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 6, skipRenderOnChange: true},
{group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 7, skipRenderOnChange: true},
{group: 'menu-list-bullet-group', id: 'id-markers-' + Common.UI.getId(), type: 0, subtype: 8, skipRenderOnChange: true},
{group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 4, skipRenderOnChange: true},
{group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 5, skipRenderOnChange: true},
{group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 6, skipRenderOnChange: true},
{group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 1, skipRenderOnChange: true},
{group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 2, skipRenderOnChange: true},
{group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 3, skipRenderOnChange: true},
{group: 'menu-list-number-group', id: 'id-numbers-' + Common.UI.getId(), type: 1, subtype: 7, skipRenderOnChange: true}
]),
groups: new Common.UI.DataViewGroupStore([
{id: 'menu-list-bullet-group', caption: this.textBullets},