Repository navigation
Feature/data column first - #2443
Open
kekovubicahome wants to merge 2 commits into
Open
kekovubicahome wants to merge 2 commits into
kekovubicahome wants to merge 2 commits into
Conversation
… `data (-2)` column before user defined columns.
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
pivotTable.go - Add pivot table column field position option (DataColumnFirst)
New Feature: DataColumnFirst option for PivotTableOptions
Added a new
DataColumnFirstboolean field to thePivotTableOptionsstruct (pivotTable.go:50). This option controls the position of the system "Values" (Data) column on the pivot table column axis when multiple data fields are present.Behavior:
DataColumnFirst: true- The Values column () is placed BEFORE user-defined column fields in the elementDataColumnFirst: false(default) - The Values column is placed AFTER user-defined column fields (maintains backward compatibility)Changes:
pivotTable.go (lines 997-1024) - Modified
addPivotColFields()function to implement position logic:DataColumnFirstistrue, inserts the Values field (x: -2) before user column fieldsDataColumnFirstisfalse(default), maintains existing behavior of appending after user columnslen(opts.Data) > 1)pivotTable.go (lines 1469-1480) - Enhanced
extractPivotTableFields()function:DataColumnFirst: truewhen field -2 appears at the beginning ofpt.ColFields.FieldDataColumnFirst: falsewhen field -2 appears after user fieldspivotTable_test.go (lines 692-1050) - Comprehensive test coverage:
TestAddPivotColFields()with scenarios for both DataColumnFirst configurationsGetPivotTables()TestExtractPivotTableFields()with detection logic verificationUse Case Example
Generated XML with DataColumnFirst: true
Generated XML with DataColumnFirst: false (default)
Backward Compatibility
This change is fully backward compatible. The default value of
DataColumnFirstisfalse, which preserves the existing behavior. Existing code that doesn't specify this option will continue to work without any modifications.Testing
All tests pass:
Benefits