[SSE] Apply auto values for pivot groups
This commit is contained in:
parent
7cfa187b70
commit
9d18c8ce13
|
@ -482,7 +482,7 @@ define([
|
||||||
item.value=='grouping' ? this.api.asc_groupPivot() : this.api.asc_ungroupPivot();
|
item.value=='grouping' ? this.api.asc_groupPivot() : this.api.asc_ungroupPivot();
|
||||||
},
|
},
|
||||||
|
|
||||||
onShowPivotGroupDialog: function(rangePr, dateTypes) {
|
onShowPivotGroupDialog: function(rangePr, dateTypes, defRangePr) {
|
||||||
var win, props,
|
var win, props,
|
||||||
me = this;
|
me = this;
|
||||||
win = new SSE.Views.PivotGroupDialog({
|
win = new SSE.Views.PivotGroupDialog({
|
||||||
|
@ -496,7 +496,7 @@ define([
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
win.show();
|
win.show();
|
||||||
win.setSettings(rangePr, dateTypes, me.permissions.lang);
|
win.setSettings(rangePr, dateTypes, defRangePr, me.permissions.lang);
|
||||||
},
|
},
|
||||||
|
|
||||||
onClear: function(menu, item) {
|
onClear: function(menu, item) {
|
||||||
|
|
|
@ -131,7 +131,9 @@ define([
|
||||||
labelText: this.textStart
|
labelText: this.textStart
|
||||||
});
|
});
|
||||||
this.chStart.on('change', function (field, newValue, oldValue, eOpts) {
|
this.chStart.on('change', function (field, newValue, oldValue, eOpts) {
|
||||||
|
if (newValue=='checked' && !me.dateTypes && me.defRangePr) {
|
||||||
|
me.inputStart.setValue(me.defRangePr.start);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.chEnd = new Common.UI.CheckBox({
|
this.chEnd = new Common.UI.CheckBox({
|
||||||
|
@ -139,7 +141,9 @@ define([
|
||||||
labelText: this.textEnd
|
labelText: this.textEnd
|
||||||
});
|
});
|
||||||
this.chEnd.on('change', function (field, newValue, oldValue, eOpts) {
|
this.chEnd.on('change', function (field, newValue, oldValue, eOpts) {
|
||||||
|
if (newValue=='checked' && !me.dateTypes && me.defRangePr) {
|
||||||
|
me.inputEnd.setValue(me.defRangePr.end);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.inputStart = new Common.UI.InputField({
|
this.inputStart = new Common.UI.InputField({
|
||||||
|
@ -232,7 +236,7 @@ define([
|
||||||
this.btnOk.setDisabled(selected<1);
|
this.btnOk.setDisabled(selected<1);
|
||||||
},
|
},
|
||||||
|
|
||||||
setSettings: function (rangePr, dateTypes, lang) {
|
setSettings: function (rangePr, dateTypes, defRangePr, lang) {
|
||||||
this.$window.find('.group-number').toggleClass('hidden', !!dateTypes);
|
this.$window.find('.group-number').toggleClass('hidden', !!dateTypes);
|
||||||
this.$window.find('.group-date').toggleClass('hidden', !dateTypes);
|
this.$window.find('.group-date').toggleClass('hidden', !dateTypes);
|
||||||
if (rangePr) {
|
if (rangePr) {
|
||||||
|
@ -242,6 +246,9 @@ define([
|
||||||
this.inputEnd.setValue((dateTypes ? new Date(rangePr.asc_getEndDate()).toLocaleDateString(lang) : rangePr.asc_getEndNum()) || '');
|
this.inputEnd.setValue((dateTypes ? new Date(rangePr.asc_getEndDate()).toLocaleDateString(lang) : rangePr.asc_getEndNum()) || '');
|
||||||
!dateTypes && this.inputBy.setValue(rangePr.asc_getGroupInterval() || '');
|
!dateTypes && this.inputBy.setValue(rangePr.asc_getGroupInterval() || '');
|
||||||
this.rangePr = rangePr;
|
this.rangePr = rangePr;
|
||||||
|
if (defRangePr) {
|
||||||
|
this.defRangePr = {start: defRangePr.asc_getStartNum(), end: defRangePr.asc_getEndNum()};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (dateTypes) {
|
if (dateTypes) {
|
||||||
var me = this,
|
var me = this,
|
||||||
|
@ -270,8 +277,8 @@ define([
|
||||||
this.rangePr.asc_setStartDate(new Date(this.inputStart.getValue()).getTime());
|
this.rangePr.asc_setStartDate(new Date(this.inputStart.getValue()).getTime());
|
||||||
this.rangePr.asc_setEndDate(new Date(this.inputEnd.getValue()).getTime());
|
this.rangePr.asc_setEndDate(new Date(this.inputEnd.getValue()).getTime());
|
||||||
} else {
|
} else {
|
||||||
this.rangePr.asc_setStartNum(parseFloat(this.inputStart.getValue()));
|
this.rangePr.asc_setStartNum(parseFloat(this.inputStart.getValue().toString().replace(',','.')));
|
||||||
this.rangePr.asc_setEndNum(parseFloat(this.inputEnd.getValue()));
|
this.rangePr.asc_setEndNum(parseFloat(this.inputEnd.getValue().toString().replace(',','.')));
|
||||||
this.rangePr.asc_setGroupInterval(parseFloat(this.inputBy.getValue()));
|
this.rangePr.asc_setGroupInterval(parseFloat(this.inputBy.getValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -281,13 +288,13 @@ define([
|
||||||
|
|
||||||
isRangeValid: function() {
|
isRangeValid: function() {
|
||||||
if (this.dateTypes) {
|
if (this.dateTypes) {
|
||||||
var res1 = new Date(this.inputStart.getValue()).getTime();
|
var res1 = new Date(this.inputStart.getValue().toString()).getTime();
|
||||||
if (isNaN(res1)) {
|
if (isNaN(res1)) {
|
||||||
this.inputStart.showError([this.textError]);
|
this.inputStart.showError([this.textError]);
|
||||||
this.inputStart.focus();
|
this.inputStart.focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var res2 = new Date(this.inputEnd.getValue()).getTime();
|
var res2 = new Date(this.inputEnd.getValue().toString()).getTime();
|
||||||
if (isNaN(res2)) {
|
if (isNaN(res2)) {
|
||||||
this.inputEnd.showError([this.textError]);
|
this.inputEnd.showError([this.textError]);
|
||||||
this.inputEnd.focus();
|
this.inputEnd.focus();
|
||||||
|
@ -300,19 +307,19 @@ define([
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var regstr = new RegExp('^\s*[0-9]+[,.]?[0-9]*\s*$');
|
var regstr = new RegExp('^\s*[0-9]+[,.]?[0-9]*\s*$');
|
||||||
var res1 = this.inputStart.getValue();
|
var res1 = this.inputStart.getValue().toString();
|
||||||
if (!regstr.test(res1)) {
|
if (!regstr.test(res1)) {
|
||||||
this.inputStart.showError([this.textError]);
|
this.inputStart.showError([this.textError]);
|
||||||
this.inputStart.focus();
|
this.inputStart.focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var res2 = this.inputEnd.getValue();
|
var res2 = this.inputEnd.getValue().toString();
|
||||||
if (!regstr.test(res2)) {
|
if (!regstr.test(res2)) {
|
||||||
this.inputEnd.showError([this.textError]);
|
this.inputEnd.showError([this.textError]);
|
||||||
this.inputEnd.focus();
|
this.inputEnd.focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (parseFloat(res2)<parseFloat(res1)) {
|
if (parseFloat(res2.replace(',','.'))<parseFloat(res1.replace(',','.'))) {
|
||||||
Common.UI.warning({msg: this.textGreaterError, maxwidth: 600});
|
Common.UI.warning({msg: this.textGreaterError, maxwidth: 600});
|
||||||
this.inputEnd.focus();
|
this.inputEnd.focus();
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue