[SSE] Apply value field settings for pivot
This commit is contained in:
parent
645f8cd55b
commit
5c4b977e32
|
@ -49,7 +49,7 @@ define([
|
||||||
SSE.Views.ValueFieldSettingsDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({
|
SSE.Views.ValueFieldSettingsDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({
|
||||||
options: {
|
options: {
|
||||||
contentWidth: 284,
|
contentWidth: 284,
|
||||||
height: 220
|
height: 320
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize : function(options) {
|
initialize : function(options) {
|
||||||
|
@ -80,22 +80,22 @@ define([
|
||||||
'<div id="value-field-settings-summarize" class="input-group-nr" style="width:264px;"></div>',
|
'<div id="value-field-settings-summarize" class="input-group-nr" style="width:264px;"></div>',
|
||||||
'</td>',
|
'</td>',
|
||||||
'</tr>',
|
'</tr>',
|
||||||
// '<tr>',
|
'<tr>',
|
||||||
// '<td colspan="2" class="padding-large">',
|
'<td colspan="2" class="padding-large">',
|
||||||
// '<label class="header">', me.txtShowAs,'</label>',
|
'<label class="header">', me.txtShowAs,'</label>',
|
||||||
// '<div id="value-field-settings-showas" class="input-group-nr" style="width:264px;"></div>',
|
'<div id="value-field-settings-showas" class="input-group-nr" style="width:264px;"></div>',
|
||||||
// '</td>',
|
'</td>',
|
||||||
// '</tr>',
|
'</tr>',
|
||||||
// '<tr class="format-code">',
|
'<tr class="format-code">',
|
||||||
// '<td>',
|
'<td>',
|
||||||
// '<label class="header">', me.txtBaseField,'</label>',
|
'<label class="header">', me.txtBaseField,'</label>',
|
||||||
// '<div id="value-field-settings-field" class="input-group-nr" style="width:128px;"></div>',
|
'<div id="value-field-settings-field" class="input-group-nr" style="width:128px;"></div>',
|
||||||
// '</td>',
|
'</td>',
|
||||||
// '<td style="float: right;">',
|
'<td style="float: right;">',
|
||||||
// '<label class="header">', me.txtBaseItem,'</label>',
|
'<label class="header">', me.txtBaseItem,'</label>',
|
||||||
// '<div id="value-field-settings-item" class="input-group-nr" style="width:128px;"></div>',
|
'<div id="value-field-settings-item" class="input-group-nr" style="width:128px;"></div>',
|
||||||
// '</td>',
|
'</td>',
|
||||||
// '</tr>',
|
'</tr>',
|
||||||
'</table>',
|
'</table>',
|
||||||
'</div></div>',
|
'</div></div>',
|
||||||
'</div>',
|
'</div>',
|
||||||
|
@ -147,7 +147,7 @@ define([
|
||||||
this.cmbSummarize.setValue(Asc.c_oAscDataConsolidateFunction.Sum);
|
this.cmbSummarize.setValue(Asc.c_oAscDataConsolidateFunction.Sum);
|
||||||
this.cmbSummarize.on('selected', _.bind(this.onSummarizeSelect, this));
|
this.cmbSummarize.on('selected', _.bind(this.onSummarizeSelect, this));
|
||||||
|
|
||||||
/*
|
|
||||||
this.cmbShowAs = new Common.UI.ComboBox({
|
this.cmbShowAs = new Common.UI.ComboBox({
|
||||||
el: $('#value-field-settings-showas'),
|
el: $('#value-field-settings-showas'),
|
||||||
cls: 'input-group-nr',
|
cls: 'input-group-nr',
|
||||||
|
@ -155,13 +155,18 @@ define([
|
||||||
editable: false,
|
editable: false,
|
||||||
data: [
|
data: [
|
||||||
{ value: Asc.c_oAscShowDataAs.Normal, displayValue: this.txtNormal },
|
{ value: Asc.c_oAscShowDataAs.Normal, displayValue: this.txtNormal },
|
||||||
{ value: Asc.c_oAscShowDataAs.PercentOfRow, displayValue: this.txtPercentOfRow },
|
|
||||||
{ value: Asc.c_oAscShowDataAs.PercentOfCol, displayValue: this.txtPercentOfCol },
|
{ value: Asc.c_oAscShowDataAs.PercentOfCol, displayValue: this.txtPercentOfCol },
|
||||||
{ value: Asc.c_oAscShowDataAs.PercentOfTotal, displayValue: this.txtPercentOfTotal },
|
{ value: Asc.c_oAscShowDataAs.PercentOfRow, displayValue: this.txtPercentOfRow },
|
||||||
{ value: Asc.c_oAscShowDataAs.Percent, displayValue: this.txtPercent },
|
{ value: Asc.c_oAscShowDataAs.Percent, displayValue: this.txtPercent },
|
||||||
|
{ value: Asc.c_oAscShowDataAs.PercentOfParentRow, displayValue: this.txtPercentOfParentRow },
|
||||||
|
{ value: Asc.c_oAscShowDataAs.PercentOfParentCol, displayValue: this.txtPercentOfParentCol },
|
||||||
|
{ value: Asc.c_oAscShowDataAs.PercentOfParent, displayValue: this.txtPercentOfParent },
|
||||||
{ value: Asc.c_oAscShowDataAs.Difference, displayValue: this.txtDifference },
|
{ value: Asc.c_oAscShowDataAs.Difference, displayValue: this.txtDifference },
|
||||||
{ value: Asc.c_oAscShowDataAs.PercentDiff, displayValue: this.txtPercentDiff },
|
{ value: Asc.c_oAscShowDataAs.PercentDiff, displayValue: this.txtPercentDiff },
|
||||||
{ value: Asc.c_oAscShowDataAs.RunTotal, displayValue: this.txtRunTotal },
|
{ value: Asc.c_oAscShowDataAs.RunTotal, displayValue: this.txtRunTotal },
|
||||||
|
{ value: Asc.c_oAscShowDataAs.PercentOfTotal, displayValue: this.txtPercentOfTotal },
|
||||||
|
{ value: Asc.c_oAscShowDataAs.RankAscending, displayValue: this.txtRankAscending },
|
||||||
|
{ value: Asc.c_oAscShowDataAs.RankDescending, displayValue: this.txtRankDescending },
|
||||||
{ value: Asc.c_oAscShowDataAs.Index, displayValue: this.txtIndex }
|
{ value: Asc.c_oAscShowDataAs.Index, displayValue: this.txtIndex }
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
@ -187,7 +192,7 @@ define([
|
||||||
scrollAlwaysVisible: true
|
scrollAlwaysVisible: true
|
||||||
});
|
});
|
||||||
this.cmbBaseItem.on('selected', _.bind(this.onBaseItemSelect, this));
|
this.cmbBaseItem.on('selected', _.bind(this.onBaseItemSelect, this));
|
||||||
*/
|
|
||||||
|
|
||||||
this.lblSourceName = this.$window.find('#value-field-settings-source');
|
this.lblSourceName = this.$window.find('#value-field-settings-source');
|
||||||
|
|
||||||
|
@ -215,22 +220,25 @@ define([
|
||||||
this.inputCustomName.setValue(Common.Utils.String.htmlEncode(field.asc_getName()));
|
this.inputCustomName.setValue(Common.Utils.String.htmlEncode(field.asc_getName()));
|
||||||
this.cmbSummarize.setValue(field.asc_getSubtotal());
|
this.cmbSummarize.setValue(field.asc_getSubtotal());
|
||||||
|
|
||||||
/*
|
|
||||||
var show_as = field.asc_getShowDataAs();
|
var show_as = field.asc_getShowDataAs();
|
||||||
this.cmbShowAs.setValue(show_as);
|
this.cmbShowAs.setValue(show_as);
|
||||||
var data = [];
|
var data = [];
|
||||||
this.names.forEach(function(item){
|
this.names.forEach(function(item, index){
|
||||||
data.push({value: item, displayValue: item});
|
data.push({value: index, displayValue: item});
|
||||||
});
|
});
|
||||||
this.cmbBaseField.setData(data);
|
this.cmbBaseField.setData(data);
|
||||||
this.cmbBaseField.setValue(this.names[0]);
|
this.cmbBaseField.setValue(field.asc_getBaseField(), '');
|
||||||
this.cmbBaseField.setDisabled(show_as != c_oAscShowDataAs.Difference && show_as != c_oAscShowDataAs.Percent &&
|
this.cmbBaseField.setDisabled(show_as === c_oAscShowDataAs.Normal || show_as === c_oAscShowDataAs.PercentOfTotal || show_as === c_oAscShowDataAs.PercentOfRow ||
|
||||||
show_as != c_oAscShowDataAs.PercentDiff && show_as != c_oAscShowDataAs.RunTotal);
|
show_as === c_oAscShowDataAs.PercentOfCol || show_as === c_oAscShowDataAs.PercentOfParentRow || show_as === c_oAscShowDataAs.Index);
|
||||||
|
|
||||||
// this.cmbBaseItem.setData(data);
|
data = [
|
||||||
this.cmbBaseItem.setDisabled(show_as != c_oAscShowDataAs.Difference && show_as != c_oAscShowDataAs.Percent &&
|
{value: -1, displayValue: this.textPrev, type: 1},
|
||||||
show_as != c_oAscShowDataAs.PercentDiff);
|
{value: -2, displayValue: this.textNext, type: 1}
|
||||||
*/
|
];
|
||||||
|
// add other values
|
||||||
|
this.cmbBaseItem.setData(data);
|
||||||
|
this.cmbBaseItem.setDisabled(show_as !== c_oAscShowDataAs.Difference && show_as !== c_oAscShowDataAs.Percent && show_as !== c_oAscShowDataAs.PercentDiff);
|
||||||
|
this.cmbBaseItem.setValue((show_as === c_oAscShowDataAs.Difference || show_as === c_oAscShowDataAs.Percent || show_as === c_oAscShowDataAs.PercentDiff) ? field.asc_getBaseItem() : '', '');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -238,6 +246,12 @@ define([
|
||||||
var field = new Asc.CT_DataField();
|
var field = new Asc.CT_DataField();
|
||||||
field.asc_setName(this.inputCustomName.getValue());
|
field.asc_setName(this.inputCustomName.getValue());
|
||||||
field.asc_setSubtotal(this.cmbSummarize.getValue());
|
field.asc_setSubtotal(this.cmbSummarize.getValue());
|
||||||
|
var show_as = this.cmbShowAs.getValue();
|
||||||
|
field.asc_setShowDataAs(show_as);
|
||||||
|
if (!this.cmbBaseField.isDisabled())
|
||||||
|
field.asc_setBaseField(this.cmbBaseField.getValue());
|
||||||
|
if (!this.cmbBaseItem.isDisabled())
|
||||||
|
field.asc_setBaseItem(this.cmbBaseItem.getValue());
|
||||||
|
|
||||||
return field;
|
return field;
|
||||||
},
|
},
|
||||||
|
@ -262,12 +276,25 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onShowAsSelect: function(combo, record) {
|
onShowAsSelect: function(combo, record) {
|
||||||
// var show_as = record.value;
|
var show_as = record.value;
|
||||||
// this.cmbBaseField.setDisabled(show_as != c_oAscShowDataAs.Difference && show_as != c_oAscShowDataAs.Percent &&
|
this.cmbBaseField.setDisabled(show_as === c_oAscShowDataAs.Normal || show_as === c_oAscShowDataAs.PercentOfTotal || show_as === c_oAscShowDataAs.PercentOfRow ||
|
||||||
// show_as != c_oAscShowDataAs.PercentDiff && show_as != c_oAscShowDataAs.RunTotal);
|
show_as === c_oAscShowDataAs.PercentOfCol || show_as === c_oAscShowDataAs.PercentOfParentRow || show_as === c_oAscShowDataAs.Index);
|
||||||
|
|
||||||
|
this.cmbBaseItem.setDisabled(show_as !== c_oAscShowDataAs.Difference && show_as !== c_oAscShowDataAs.Percent && show_as !== c_oAscShowDataAs.PercentDiff);
|
||||||
|
this.cmbBaseItem.setValue((show_as === c_oAscShowDataAs.Difference || show_as === c_oAscShowDataAs.Percent || show_as === c_oAscShowDataAs.PercentDiff) && this.cmbBaseItem.store.length>0 ?
|
||||||
|
this.cmbBaseItem.store.at(0).get('value') : '', '');
|
||||||
},
|
},
|
||||||
|
|
||||||
onBaseFieldSelect: function(combo, record) {
|
onBaseFieldSelect: function(combo, record) {
|
||||||
|
// var data = [
|
||||||
|
// {value: -1, displayValue: this.textPrev, type: 1},
|
||||||
|
// {value: -2, displayValue: this.textNext, type: 1}
|
||||||
|
// ];
|
||||||
|
// add other values
|
||||||
|
// this.cmbBaseItem.setData(data);
|
||||||
|
// var show_as = this.cmbShowAs.getValue();
|
||||||
|
// this.cmbBaseItem.setValue(show_as !== c_oAscShowDataAs.Difference && show_as !== c_oAscShowDataAs.Percent && show_as !== c_oAscShowDataAs.PercentDiff && this.cmbBaseItem.store.length>0 ?
|
||||||
|
// this.cmbBaseItem.store.at(0).get('value') : '', '');
|
||||||
},
|
},
|
||||||
|
|
||||||
onBaseItemSelect: function(combo, record) {
|
onBaseItemSelect: function(combo, record) {
|
||||||
|
@ -291,16 +318,23 @@ define([
|
||||||
txtSum: 'Sum',
|
txtSum: 'Sum',
|
||||||
txtVar: 'Var',
|
txtVar: 'Var',
|
||||||
txtVarp: 'Varp',
|
txtVarp: 'Varp',
|
||||||
txtNormal: 'No Calculation',
|
txtNormal: 'No calculation',
|
||||||
txtDifference: 'The Difference From',
|
txtDifference: 'The difference from',
|
||||||
txtPercent: 'Percent of',
|
txtPercent: '% of',
|
||||||
txtPercentDiff: 'Percent Difference From',
|
txtPercentDiff: '% difference from',
|
||||||
txtRunTotal: 'Running Total In',
|
txtRunTotal: 'Running total in',
|
||||||
txtPercentOfRow: 'Percent of Total',
|
txtPercentOfRow: '% of total',
|
||||||
txtPercentOfCol: 'Percent of Column',
|
txtPercentOfCol: '% of column total',
|
||||||
txtPercentOfTotal: 'Percent of Row',
|
txtPercentOfTotal: '% of row total',
|
||||||
txtIndex: 'Index',
|
txtIndex: 'Index',
|
||||||
txtByField: '%1 of %2'
|
txtByField: '%1 of %2',
|
||||||
|
txtPercentOfParentRow: '% of parent row total',
|
||||||
|
txtPercentOfParentCol: '% of parent column total',
|
||||||
|
txtPercentOfParent: '% of parent total',
|
||||||
|
txtRankAscending: 'Rank smallest to largest',
|
||||||
|
txtRankDescending: 'Rank largest to smallest',
|
||||||
|
textPrev: '(previous)',
|
||||||
|
textNext: '(next)'
|
||||||
|
|
||||||
}, SSE.Views.ValueFieldSettingsDialog || {}))
|
}, SSE.Views.ValueFieldSettingsDialog || {}))
|
||||||
});
|
});
|
Loading…
Reference in a new issue