[SSE] fixed checkboxes in list in 'AutoFilter' dialog

This commit is contained in:
Maxim Kadushkin 2019-12-11 16:57:37 +03:00
parent 070aabce8f
commit ed887865a0

View file

@ -758,14 +758,8 @@ define([
itemTemplate: _.template([
'<div>',
'<label class="checkbox-indeterminate" style="position:absolute;">',
'<% if (check=="indeterminate") { %>',
'<input type="button" class="indeterminate button__checkbox">',
'<% } else if (check) { %>',
'<input type="button" class="checked button__checkbox">',
'<% } else { %>',
'<input type="button" class="button__checkbox">',
'<% } %>',
'<span class="checkmark"/>',
'<input id="afcheckbox-<%= id %>" type="checkbox" class="button__checkbox">',
'<label for="afcheckbox-<%= id %>" class="checkbox__shape" />',
'</label>',
'<div id="<%= id %>" class="list-item" style="pointer-events:none; margin-left: 20px;display: flex;">',
'<div style="flex-grow: 1;"><%= Common.Utils.String.htmlEncode(value) %></div>',
@ -791,7 +785,11 @@ define([
if (n1==n2) return 0;
return (n2=='' || n1!=='' && n1<n2) ? -1 : 1;
};
this.cellsList.on('item:select', _.bind(this.onCellCheck, this));
this.cellsList.on({
'item:change': this.onItemChanged.bind(this),
'item:add': this.onItemChanged.bind(this),
'item:select': this.onCellCheck.bind(this)
});
this.cellsList.onKeyDown = _.bind(this.onListKeyDown, this);
}
@ -999,11 +997,10 @@ define([
if (this.checkCellTrigerBlock)
return;
var target = '', type = '', isLabel = false, bound = null;
var target = '', isLabel = false, bound = null;
var event = window.event ? window.event : window._event;
if (event) {
type = event.target.type;
target = $(event.currentTarget).find('.list-item');
if (target.length) {
@ -1016,7 +1013,7 @@ define([
}
}
if (type === 'button' || isLabel || event.target.className.match('checkmark')) {
if (isLabel || event.target.className.match('checkbox')) {
this.updateCellCheck(listView, record);
_.delay(function () {
@ -1044,7 +1041,7 @@ define([
updateCellCheck: function (listView, record) {
if (record && listView) {
listView.isSuspendEvents = true;
// listView.isSuspendEvents = true;
var check = !record.get('check'),
me = this,
@ -1077,7 +1074,7 @@ define([
this.btnOk.setDisabled(false);
this.configTo.asc_getFilterObj().asc_setType(Asc.c_oAscAutoFilterTypes.Filters);
listView.isSuspendEvents = false;
// listView.isSuspendEvents = false;
listView.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true, suppressScrollX: true});
}
},
@ -1400,6 +1397,13 @@ define([
Common.Utils.InternalSettings.set('sse-settings-size-filter-window', size);
},
onItemChanged: function (view, record) {
var state = record.model.get('check');
if ( state == 'indeterminate' )
$('input[type=checkbox]', record.$el).prop('indeterminate', true);
else $('input[type=checkbox]', record.$el).prop({checked: state, indeterminate: false});
},
btnCustomFilter : 'Custom Filter',
textSelectAll : 'Select All',
txtTitle : 'Filter',