[SSE mobile] repaired Sort&Filter page

This commit is contained in:
Maxim Kadushkin 2016-12-20 18:23:02 +03:00
parent edac20cc81
commit ec45ab8d90
3 changed files with 31 additions and 1 deletions

View file

@ -68,6 +68,8 @@ define([
'page:show' : this.onPageShow
, 'link:insert': this.onInsertLink
, 'image:insert': this.onInsertImage
, 'insert:sort': this.onInsertSort
, 'insert:filter': this.onInsertFilter
, 'link:changetype': this.onChangeLinkType
, 'link:changesheet': this.onChangeLinkSheet
}
@ -128,6 +130,10 @@ define([
view.optionAllowInternal(allowinternal);
allowinternal && view.optionLinkType( this.optsLink.type );
} else
if (pageId == '#addother-sort') {
var filterInfo = this.api.asc_getCellInfo().asc_getAutoFilterInfo();
view.optionAutofilter( filterInfo ? filterInfo.asc_getIsAutoFilter() : null)
} else
if (pageId == '#addother-change-linktype') {
view.optionLinkType( this.optsLink.type );
}
@ -214,6 +220,18 @@ define([
}
},
onInsertSort: function(type) {
this.api.asc_sortColFilter(type == 'down' ? Asc.c_oAscSortOptions.Ascending : Asc.c_oAscSortOptions.Descending, '');
},
onInsertFilter: function(checked) {
var formatTableInfo = this.api.asc_getCellInfo().asc_getFormatTableInfo();
var tablename = (formatTableInfo) ? formatTableInfo.asc_getTableName() : undefined;
if (checked)
this.api.asc_addAutoFilter(); else
this.api.asc_changeAutoFilter(tablename, Asc.c_oAscChangeFilterOptions.filter, checked);
},
textInvalidRange: 'ERROR! Invalid cells range',
textEmptyImgUrl : 'You need to specify image URL.',
txtNotUrl: 'This field should be a URL in the format \"http://www.example.com\"'

View file

@ -240,7 +240,7 @@
</div>
<div class="list-block">
<ul>
<li id="paragraph-page-break">
<li id="other-chb-insfilter">
<div class="item-content">
<div class="item-inner">
<div class="item-title"><%= scope.textFilter %></div>

View file

@ -152,6 +152,14 @@ define([
showSortPage: function (e) {
this.showPage('#addother-sort');
var me = this;
$('.settings .sortdown').single('click', function (e) {me.fireEvent('insert:sort',['down']);});
$('.settings .sortup').single('click', function (e) {me.fireEvent('insert:sort',['up']);});
$('.settings #other-chb-insfilter input:checkbox').single('change', function (e) {
var $checkbox = $(e.currentTarget);
me.fireEvent('insert:filter', [$checkbox.is(':checked')]);
});
},
clickInsertLink: function (e) {
@ -187,6 +195,10 @@ define([
_.delay(function () { $input.focus(); }, 1000);
},
optionAutofilter: function (checked) {
$('.settings #other-chb-insfilter input:checkbox').prop('checked', checked);
},
optionLinkType: function (type, opts) {
this.link.type = type;