[SSE] Data tab: add filters buttons
This commit is contained in:
parent
31f2252617
commit
27b7286119
|
@ -120,7 +120,9 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'DataTab': {
|
'DataTab': {
|
||||||
'data:sort': this.onSortType
|
'data:sort': this.onSortType,
|
||||||
|
'data:setfilter': this.onAutoFilter,
|
||||||
|
'data:clearfilter': this.onClearFilter
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Common.NotificationCenter.on('page:settings', _.bind(this.onApiSheetChanged, this));
|
Common.NotificationCenter.on('page:settings', _.bind(this.onApiSheetChanged, this));
|
||||||
|
@ -315,8 +317,6 @@ define([
|
||||||
toolbar.btnInsertText.on('click', _.bind(this.onBtnInsertTextClick, this));
|
toolbar.btnInsertText.on('click', _.bind(this.onBtnInsertTextClick, this));
|
||||||
toolbar.btnInsertShape.menu.on('hide:after', _.bind(this.onInsertShapeHide, this));
|
toolbar.btnInsertShape.menu.on('hide:after', _.bind(this.onInsertShapeHide, this));
|
||||||
toolbar.btnInsertEquation.on('click', _.bind(this.onInsertEquationClick, this));
|
toolbar.btnInsertEquation.on('click', _.bind(this.onInsertEquationClick, this));
|
||||||
toolbar.btnSetAutofilter.on('click', _.bind(this.onAutoFilter, this));
|
|
||||||
toolbar.btnClearAutofilter.on('click', _.bind(this.onClearFilter, this));
|
|
||||||
toolbar.btnTableTemplate.menu.on('show:after', _.bind(this.onTableTplMenuOpen, this));
|
toolbar.btnTableTemplate.menu.on('show:after', _.bind(this.onTableTplMenuOpen, this));
|
||||||
toolbar.btnPercentStyle.on('click', _.bind(this.onNumberFormat, this));
|
toolbar.btnPercentStyle.on('click', _.bind(this.onNumberFormat, this));
|
||||||
toolbar.btnCurrencyStyle.on('click', _.bind(this.onNumberFormat, this));
|
toolbar.btnCurrencyStyle.on('click', _.bind(this.onNumberFormat, this));
|
||||||
|
@ -2188,12 +2188,14 @@ define([
|
||||||
|
|
||||||
val = (filterInfo) ? filterInfo.asc_getIsAutoFilter() : null;
|
val = (filterInfo) ? filterInfo.asc_getIsAutoFilter() : null;
|
||||||
if (this._state.filter !== val) {
|
if (this._state.filter !== val) {
|
||||||
toolbar.btnSetAutofilter.toggle(val===true, true);
|
toolbar.btnsSetAutofilter.forEach(function(button) {
|
||||||
|
button.toggle(val===true, true);
|
||||||
|
});
|
||||||
this._state.filter = val;
|
this._state.filter = val;
|
||||||
}
|
}
|
||||||
need_disable = this._state.controlsdisabled.filters || (val===null);
|
need_disable = this._state.controlsdisabled.filters || (val===null);
|
||||||
toolbar.lockToolbar(SSE.enumLock.ruleFilter, need_disable,
|
toolbar.lockToolbar(SSE.enumLock.ruleFilter, need_disable,
|
||||||
{ array: [toolbar.btnTableTemplate,toolbar.btnSetAutofilter].concat(toolbar.btnsSortDown).concat(toolbar.btnsSortUp) });
|
{ array: [toolbar.btnTableTemplate].concat(toolbar.btnsSetAutofilter).concat(toolbar.btnsSortDown).concat(toolbar.btnsSortUp) });
|
||||||
|
|
||||||
val = (formatTableInfo) ? formatTableInfo.asc_getTableStyleName() : null;
|
val = (formatTableInfo) ? formatTableInfo.asc_getTableStyleName() : null;
|
||||||
if (this._state.tablestylename !== val && this.toolbar.mnuTableTemplatePicker) {
|
if (this._state.tablestylename !== val && this.toolbar.mnuTableTemplatePicker) {
|
||||||
|
@ -2208,7 +2210,7 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
need_disable = this._state.controlsdisabled.filters || !filterInfo || (filterInfo.asc_getIsApplyAutoFilter()!==true);
|
need_disable = this._state.controlsdisabled.filters || !filterInfo || (filterInfo.asc_getIsApplyAutoFilter()!==true);
|
||||||
toolbar.lockToolbar(SSE.enumLock.ruleDelFilter, need_disable, {array:[toolbar.btnClearAutofilter]});
|
toolbar.lockToolbar(SSE.enumLock.ruleDelFilter, need_disable, {array: toolbar.btnsClearAutofilter});
|
||||||
|
|
||||||
var old_name = this._state.tablename;
|
var old_name = this._state.tablename;
|
||||||
this._state.tablename = (formatTableInfo) ? formatTableInfo.asc_getTableName() : undefined;
|
this._state.tablename = (formatTableInfo) ? formatTableInfo.asc_getTableName() : undefined;
|
||||||
|
@ -2223,11 +2225,10 @@ define([
|
||||||
toolbar.lockToolbar(SSE.enumLock.multiselect, this._state.multiselect, { array: [toolbar.btnTableTemplate, toolbar.btnInsertHyperlink]});
|
toolbar.lockToolbar(SSE.enumLock.multiselect, this._state.multiselect, { array: [toolbar.btnTableTemplate, toolbar.btnInsertHyperlink]});
|
||||||
|
|
||||||
this._state.inpivot = !!info.asc_getPivotTableInfo();
|
this._state.inpivot = !!info.asc_getPivotTableInfo();
|
||||||
toolbar.lockToolbar(SSE.enumLock.editPivot, this._state.inpivot, { array: [toolbar.btnMerge, toolbar.btnInsertHyperlink, toolbar.btnSetAutofilter, toolbar.btnClearAutofilter].concat(toolbar.btnsSortDown).concat(toolbar.btnsSortUp)});
|
toolbar.lockToolbar(SSE.enumLock.editPivot, this._state.inpivot, { array: [toolbar.btnMerge, toolbar.btnInsertHyperlink].concat(toolbar.btnsSetAutofilter).concat(toolbar.btnsClearAutofilter).concat(toolbar.btnsSortDown).concat(toolbar.btnsSortUp)});
|
||||||
|
|
||||||
need_disable = !this.appConfig.canModifyFilter;
|
need_disable = !this.appConfig.canModifyFilter;
|
||||||
toolbar.lockToolbar(SSE.enumLock.cantModifyFilter, need_disable, { array: [toolbar.btnSetAutofilter,
|
toolbar.lockToolbar(SSE.enumLock.cantModifyFilter, need_disable, { array: [toolbar.btnTableTemplate, toolbar.btnClearStyle.menu.items[0], toolbar.btnClearStyle.menu.items[2] ].concat(toolbar.btnsSetAutofilter).concat(toolbar.btnsSortDown).concat(toolbar.btnsSortUp)});
|
||||||
toolbar.btnTableTemplate, toolbar.btnClearStyle.menu.items[0], toolbar.btnClearStyle.menu.items[2] ].concat(toolbar.btnsSortDown).concat(toolbar.btnsSortUp)});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2423,7 +2424,7 @@ define([
|
||||||
|
|
||||||
need_disable = this._state.controlsdisabled.filters || (val===null);
|
need_disable = this._state.controlsdisabled.filters || (val===null);
|
||||||
me.toolbar.lockToolbar(SSE.enumLock.ruleFilter, need_disable,
|
me.toolbar.lockToolbar(SSE.enumLock.ruleFilter, need_disable,
|
||||||
{ array: [me.toolbar.btnSetAutofilter].concat(me.toolbar.btnsSortDown).concat(me.toolbar.btnsSortUp) });
|
{ array: [me.toolbar.btnSetAutofilter, me.toolbar.btnSortDown, me.toolbar.btnSortUp] });
|
||||||
|
|
||||||
need_disable = this._state.controlsdisabled.filters || !filterInfo || (filterInfo.asc_getIsApplyAutoFilter()!==true);
|
need_disable = this._state.controlsdisabled.filters || !filterInfo || (filterInfo.asc_getIsApplyAutoFilter()!==true);
|
||||||
me.toolbar.lockToolbar(SSE.enumLock.ruleDelFilter, need_disable, {array: [me.toolbar.btnClearAutofilter]});
|
me.toolbar.lockToolbar(SSE.enumLock.ruleDelFilter, need_disable, {array: [me.toolbar.btnClearAutofilter]});
|
||||||
|
@ -3100,6 +3101,8 @@ define([
|
||||||
Array.prototype.push.apply(me.toolbar.lockControls, datatab.getButtons());
|
Array.prototype.push.apply(me.toolbar.lockControls, datatab.getButtons());
|
||||||
me.toolbar.btnsSortDown = datatab.getButtons('sort-down');
|
me.toolbar.btnsSortDown = datatab.getButtons('sort-down');
|
||||||
me.toolbar.btnsSortUp = datatab.getButtons('sort-up');
|
me.toolbar.btnsSortUp = datatab.getButtons('sort-up');
|
||||||
|
me.toolbar.btnsSetAutofilter = datatab.getButtons('set-filter');
|
||||||
|
me.toolbar.btnsClearAutofilter = datatab.getButtons('clear-filter');
|
||||||
|
|
||||||
if ( !config.isOffline ) {
|
if ( !config.isOffline ) {
|
||||||
tab = {action: 'pivot', caption: me.textPivot};
|
tab = {action: 'pivot', caption: me.textPivot};
|
||||||
|
|
|
@ -80,8 +80,8 @@
|
||||||
<span class="btn-slot slot-sortasc"></span>
|
<span class="btn-slot slot-sortasc"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="elset">
|
<div class="elset">
|
||||||
<span class="btn-slot split" id="slot-btn-setfilter"></span>
|
<span class="btn-slot split slot-btn-setfilter"></span>
|
||||||
<span class="btn-slot" id="slot-btn-clear-filter"></span>
|
<span class="btn-slot slot-btn-clear-filter"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="separator long"></div>
|
<div class="separator long"></div>
|
||||||
|
@ -159,6 +159,8 @@
|
||||||
<span class="btn-slot slot-sortasc"></span>
|
<span class="btn-slot slot-sortasc"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="elset">
|
<div class="elset">
|
||||||
|
<span class="btn-slot split slot-btn-setfilter"></span>
|
||||||
|
<span class="btn-slot slot-btn-clear-filter"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="separator long"></div>
|
<div class="separator long"></div>
|
||||||
|
|
|
@ -76,6 +76,16 @@ define([
|
||||||
me.fireEvent('data:sort', [Asc.c_oAscSortOptions.Descending]);
|
me.fireEvent('data:sort', [Asc.c_oAscSortOptions.Descending]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
me.btnsSetAutofilter.forEach(function(button) {
|
||||||
|
button.on('click', function (b, e) {
|
||||||
|
me.fireEvent('data:setfilter', [Asc.c_oAscSortOptions.Descending]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
me.btnsClearAutofilter.forEach(function(button) {
|
||||||
|
button.on('click', function (b, e) {
|
||||||
|
me.fireEvent('data:clearfilter', [Asc.c_oAscSortOptions.Descending]);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -88,6 +98,8 @@ define([
|
||||||
this.lockedControls = [];
|
this.lockedControls = [];
|
||||||
this.btnsSortDown = [];
|
this.btnsSortDown = [];
|
||||||
this.btnsSortUp = [];
|
this.btnsSortUp = [];
|
||||||
|
this.btnsSetAutofilter = [];
|
||||||
|
this.btnsClearAutofilter = [];
|
||||||
|
|
||||||
var me = this,
|
var me = this,
|
||||||
$host = me.toolbar.$el,
|
$host = me.toolbar.$el,
|
||||||
|
@ -99,7 +111,7 @@ define([
|
||||||
cmp.rendered ? $slot.append(cmp.$el) : cmp.render($slot);
|
cmp.rendered ? $slot.append(cmp.$el) : cmp.render($slot);
|
||||||
};
|
};
|
||||||
|
|
||||||
var _injectComponents = function ($slots, iconCls, split, menu, caption, lock, btnsArr) {
|
var _injectComponents = function ($slots, iconCls, split, menu, caption, toggle, lock, btnsArr) {
|
||||||
$slots.each(function(index, el) {
|
$slots.each(function(index, el) {
|
||||||
var _cls = 'btn-toolbar';
|
var _cls = 'btn-toolbar';
|
||||||
/x-huge/.test(el.className) && (_cls += ' x-huge icon-top');
|
/x-huge/.test(el.className) && (_cls += ' x-huge icon-top');
|
||||||
|
@ -174,14 +186,22 @@ define([
|
||||||
_injectComponent('#slot-btn-hide-details', this.btnHide);
|
_injectComponent('#slot-btn-hide-details', this.btnHide);
|
||||||
this.lockedControls.push(this.btnHide);
|
this.lockedControls.push(this.btnHide);
|
||||||
|
|
||||||
_injectComponents($host.find('.slot-sortdesc'), 'btn-sort-down', false, false, '',
|
_injectComponents($host.find('.slot-sortdesc'), 'btn-sort-down', false, false, '', false,
|
||||||
[_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot, _set.cantModifyFilter],
|
[_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot, _set.cantModifyFilter],
|
||||||
this.btnsSortDown);
|
this.btnsSortDown);
|
||||||
|
|
||||||
_injectComponents($host.find('.slot-sortasc'), 'btn-sort-up', false, false, '',
|
_injectComponents($host.find('.slot-sortasc'), 'btn-sort-up', false, false, '', false,
|
||||||
[_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot, _set.cantModifyFilter],
|
[_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot, _set.cantModifyFilter],
|
||||||
this.btnsSortUp);
|
this.btnsSortUp);
|
||||||
|
|
||||||
|
_injectComponents($host.find('.slot-btn-setfilter'), 'btn-autofilter', false, false, '', true,
|
||||||
|
[_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot, _set.cantModifyFilter],
|
||||||
|
this.btnsSetAutofilter);
|
||||||
|
|
||||||
|
_injectComponents($host.find('.slot-btn-clear-filter'), 'btn-clear-filter', false, false, '', false,
|
||||||
|
[_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleDelFilter, _set.editPivot],
|
||||||
|
this.btnsClearAutofilter);
|
||||||
|
|
||||||
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -213,6 +233,12 @@ define([
|
||||||
me.btnsSortUp.forEach( function(btn) {
|
me.btnsSortUp.forEach( function(btn) {
|
||||||
btn.updateHint(me.toolbar.txtSortZA);
|
btn.updateHint(me.toolbar.txtSortZA);
|
||||||
});
|
});
|
||||||
|
me.btnsSetAutofilter.forEach( function(btn) {
|
||||||
|
btn.updateHint(me.toolbar.txtFilter + ' (Ctrl+Shift+L)');
|
||||||
|
});
|
||||||
|
me.btnsClearAutofilter.forEach( function(btn) {
|
||||||
|
btn.updateHint(me.toolbar.txtClearFilter);
|
||||||
|
});
|
||||||
|
|
||||||
setEvents.call(me);
|
setEvents.call(me);
|
||||||
});
|
});
|
||||||
|
@ -228,6 +254,10 @@ define([
|
||||||
return this.btnsSortDown;
|
return this.btnsSortDown;
|
||||||
else if (type == 'sort-up')
|
else if (type == 'sort-up')
|
||||||
return this.btnsSortUp;
|
return this.btnsSortUp;
|
||||||
|
else if (type == 'set-filter')
|
||||||
|
return this.btnsSetAutofilter;
|
||||||
|
else if (type == 'clear-filter')
|
||||||
|
return this.btnsClearAutofilter;
|
||||||
else if (type===undefined)
|
else if (type===undefined)
|
||||||
return this.lockedControls;
|
return this.lockedControls;
|
||||||
return [];
|
return [];
|
||||||
|
|
|
@ -716,21 +716,6 @@ define([
|
||||||
menu : new Common.UI.Menu({cls: 'menu-shapes'})
|
menu : new Common.UI.Menu({cls: 'menu-shapes'})
|
||||||
});
|
});
|
||||||
|
|
||||||
me.btnSetAutofilter = new Common.UI.Button({
|
|
||||||
id : 'id-toolbar-btn-setautofilter',
|
|
||||||
cls : 'btn-toolbar',
|
|
||||||
iconCls : 'btn-autofilter',
|
|
||||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot, _set.cantModifyFilter],
|
|
||||||
enableToggle: true
|
|
||||||
});
|
|
||||||
|
|
||||||
me.btnClearAutofilter = new Common.UI.Button({
|
|
||||||
id : 'id-toolbar-btn-clearfilter',
|
|
||||||
cls : 'btn-toolbar',
|
|
||||||
iconCls : 'btn-clear-filter',
|
|
||||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleDelFilter, _set.editPivot]
|
|
||||||
});
|
|
||||||
|
|
||||||
me.btnTableTemplate = new Common.UI.Button({
|
me.btnTableTemplate = new Common.UI.Button({
|
||||||
id : 'id-toolbar-btn-ttempl',
|
id : 'id-toolbar-btn-ttempl',
|
||||||
cls : 'btn-toolbar',
|
cls : 'btn-toolbar',
|
||||||
|
|
Loading…
Reference in a new issue