@@ -621,7 +621,46 @@ QUnit.module('dxPivotGrid DataController', moduleConfig, () => {
621621 ] ] , 'Columns Info' ) ;
622622 } ) ;
623623
624- QUnit . test ( 'columnsInfo and rowsInfo without dimension fields when showGrandTotals is disabled on dataField level only for one field.' , function ( assert ) {
624+ QUnit . test ( 'dataFieldArea: column, hasDimensionFields: true; columnsInfo and rowsInfo when showGrandTotals is disabled only for one field' , function ( assert ) {
625+ const dataController = new DataController ( {
626+ dataSource : {
627+ fields : [
628+ { area : 'column' } , { area : 'row' } ,
629+ { dataField : 'sum' , caption : 'Sum' , format : 'fixedPoint' , area : 'data' , showGrandTotals : false } ,
630+ { dataField : 'avg' , caption : 'Avg' , format : 'fixedPoint' , area : 'data' }
631+ ] ,
632+ columns : [ { value : 'column 1' } ] ,
633+ rows : [ { value : 'row 1' } ]
634+ } ,
635+ texts : texts ,
636+ dataFieldArea : 'column'
637+ } ) ;
638+
639+ assert . deepEqual (
640+ dataController . getColumnsInfo ( ) ,
641+ [ [
642+ { type : 'D' , text : 'column 1' , path : [ 'column 1' ] , colspan : 2 } ,
643+ { type : 'GT' , text : 'Grand Total' , }
644+ ] ,
645+ [
646+ { type : 'D' , text : 'Sum' , path : [ 'column 1' ] , dataIndex : 0 , isLast : true } ,
647+ { type : 'D' , text : 'Avg' , path : [ 'column 1' ] , dataIndex : 1 , isLast : true } ,
648+ { type : 'GT' , text : 'Avg' , dataIndex : 1 , isLast : true }
649+ ] ] ,
650+ 'Columns Info'
651+ ) ;
652+
653+ assert . deepEqual (
654+ dataController . getRowsInfo ( ) ,
655+ [
656+ [ { type : 'D' , text : 'row 1' , path : [ 'row 1' ] , isLast : true } ] ,
657+ [ { type : 'GT' , text : 'Grand Total' , isLast : true } ]
658+ ] ,
659+ 'Rows Info'
660+ ) ;
661+ } ) ;
662+
663+ QUnit . test ( 'dataFieldArea: column, hasDimensionFields: false; columnsInfo and rowsInfo when showGrandTotals is disabled only for one field' , function ( assert ) {
625664 const dataController = new DataController ( {
626665 dataSource : {
627666 fields : [
@@ -631,51 +670,70 @@ QUnit.module('dxPivotGrid DataController', moduleConfig, () => {
631670 columns : [ ] ,
632671 rows : [ ]
633672 } ,
634- texts : texts
673+ texts : texts ,
674+ dataFieldArea : 'column'
635675 } ) ;
636676
637- assert . deepEqual ( dataController . getColumnsInfo ( ) , [ [
638- {
639- text : 'Grand Total' ,
640- type : 'GT'
641- } ] ,
642-
643- [ {
644- dataIndex : 1 ,
645- isLast : true ,
646- text : 'Avg' ,
647- type : 'GT'
648- } ] ] , 'Columns Info' ) ;
677+ assert . deepEqual (
678+ dataController . getColumnsInfo ( ) ,
679+ [
680+ [ { type : 'GT' , text : 'Grand Total' , } ] ,
681+ [ { type : 'GT' , text : 'Avg' , dataIndex : 1 , isLast : true } ]
682+ ] ,
683+ 'Columns Info'
684+ ) ;
649685
650- assert . deepEqual ( dataController . getRowsInfo ( ) , [ [
651- {
652- isLast : true ,
653- text : 'Grand Total' ,
654- type : 'GT'
655- }
656- ] ] , 'Rows Info' ) ;
686+ assert . deepEqual (
687+ dataController . getRowsInfo ( ) ,
688+ [
689+ [ { type : 'GT' , text : 'Grand Total' , isLast : true , } ]
690+ ] ,
691+ 'Rows Info'
692+ ) ;
657693 } ) ;
658694
659- QUnit . test ( 'T541266. No dublicate cells in Chrome 60 ' , function ( assert ) {
695+ QUnit . test ( 'dataFieldArea: row, hasDimensionFields: true; columnsInfo and rowsInfo when showGrandTotals is disabled only for one field ' , function ( assert ) {
660696 const dataController = new DataController ( {
661697 dataSource : {
662698 fields : [
663- { area : 'row' } ,
664- { area : 'row' } ,
665- { area : 'data ' , caption : 'Sum ' , format : 'fixedPoint' }
699+ { area : 'column' } , { area : ' row' } ,
700+ { dataField : 'sum' , caption : 'Sum' , format : 'fixedPoint' , area : 'data' , showGrandTotals : false } ,
701+ { dataField : 'avg ' , caption : 'Avg ' , format : 'fixedPoint' , area : 'data ' }
666702 ] ,
667- rows : [ { 'value' : 2014 , 'index' : 1 , 'text' : '2014' , 'children' : [ { 'value' : 1 , 'index' : 10 , 'text' : 'Q1' } , { 'value' : 2 , 'index' : 11 , 'text' : 'Q2' } , { 'value' : 3 , 'index' : 12 , 'text' : 'Q3' } , { 'value' : 4 , 'index' : 13 , 'text' : 'Q4' } ] } , { 'value' : 2015 , 'index' : 2 , 'text' : '2015' , 'children' : [ { 'value' : 1 , 'index' : 4 , 'text' : 'Q1' , 'children' : [ { 'value' : 1 , 'index' : 6 , 'text' : 'January' } , { 'value' : 2 , 'index' : 7 , 'text' : 'February' } , { 'value' : 3 , 'index' : 8 , 'text' : 'March' } ] } ] } ]
703+ columns : [ { value : 'column 1' } ] ,
704+ rows : [ { value : 'row 1' } ]
668705 } ,
669- texts : texts
706+ texts : texts ,
707+ dataFieldArea : 'row'
670708 } ) ;
671709
672- const rowsInfo = dataController . getRowsInfo ( true ) ;
673-
674- assert . equal ( rowsInfo [ 0 ] . length , 2 ) ;
675- assert . equal ( rowsInfo [ 5 ] . length , 3 ) ;
710+ assert . deepEqual (
711+ dataController . getColumnsInfo ( ) ,
712+ [ [
713+ { type : 'D' , text : 'column 1' , path : [ 'column 1' ] , isLast : true } ,
714+ { type : 'GT' , text : 'Grand Total' , isLast : true }
715+ ] ] ,
716+ 'Columns Info'
717+ ) ;
718+
719+ assert . deepEqual (
720+ dataController . getRowsInfo ( ) ,
721+ [ [
722+ { type : 'D' , text : 'row 1' , path : [ 'row 1' ] , rowspan : 2 } ,
723+ { type : 'D' , text : 'Sum' , path : [ 'row 1' ] , dataIndex : 0 , isLast : true }
724+ ] ,
725+ [
726+ { type : 'D' , text : 'Avg' , path : [ 'row 1' ] , dataIndex : 1 , isLast : true }
727+ ] ,
728+ [
729+ { type : 'GT' , text : 'Grand Total' } ,
730+ { type : 'GT' , text : 'Avg' , dataIndex : 1 , isLast : true }
731+ ] ] ,
732+ 'Rows Info'
733+ ) ;
676734 } ) ;
677735
678- QUnit . test ( 'columnsInfo and rowsInfo without dimension fields when showGrandTotals is disabled on dataField level only for one field and dataFieldArea = row ' , function ( assert ) {
736+ QUnit . test ( 'dataFieldArea: row, hasDimensionFields: false; columnsInfo and rowsInfo when showGrandTotals is disabled only for one field' , function ( assert ) {
679737 const dataController = new DataController ( {
680738 dataSource : {
681739 fields : [
@@ -689,38 +747,41 @@ QUnit.module('dxPivotGrid DataController', moduleConfig, () => {
689747 dataFieldArea : 'row'
690748 } ) ;
691749
692- assert . deepEqual ( dataController . getRowsInfo ( ) , [
750+ assert . deepEqual (
751+ dataController . getColumnsInfo ( ) ,
693752 [
694- {
695- text : 'Grand Total' ,
696- type : 'GT' ,
697- rowspan : 2
698- } ,
699- {
700- dataIndex : 0 ,
701- isLast : true ,
702- text : 'Sum' ,
703- type : 'GT'
704- } ,
753+ [ { type : 'GT' , text : 'Grand Total' , isLast : true } ]
705754 ] ,
706- [
707- {
708- dataIndex : 1 ,
709- isLast : true ,
710- text : 'Avg' ,
711- type : 'GT'
712- }
755+ 'Columns Info'
756+ ) ;
713757
714- ]
715- ] , 'Rows Info' ) ;
758+ assert . deepEqual (
759+ dataController . getRowsInfo ( ) ,
760+ [ [
761+ { type : 'GT' , text : 'Grand Total' , } ,
762+ { type : 'GT' , text : 'Avg' , dataIndex : 1 , isLast : true }
763+ ] ] ,
764+ 'Rows Info'
765+ ) ;
766+ } ) ;
716767
717- assert . deepEqual ( dataController . getColumnsInfo ( ) , [ [
718- {
719- isLast : true ,
720- text : 'Grand Total' ,
721- type : 'GT'
722- }
723- ] ] , 'Columns Info' ) ;
768+ QUnit . test ( 'T541266. No dublicate cells in Chrome 60' , function ( assert ) {
769+ const dataController = new DataController ( {
770+ dataSource : {
771+ fields : [
772+ { area : 'row' } ,
773+ { area : 'row' } ,
774+ { area : 'data' , caption : 'Sum' , format : 'fixedPoint' }
775+ ] ,
776+ rows : [ { 'value' : 2014 , 'index' : 1 , 'text' : '2014' , 'children' : [ { 'value' : 1 , 'index' : 10 , 'text' : 'Q1' } , { 'value' : 2 , 'index' : 11 , 'text' : 'Q2' } , { 'value' : 3 , 'index' : 12 , 'text' : 'Q3' } , { 'value' : 4 , 'index' : 13 , 'text' : 'Q4' } ] } , { 'value' : 2015 , 'index' : 2 , 'text' : '2015' , 'children' : [ { 'value' : 1 , 'index' : 4 , 'text' : 'Q1' , 'children' : [ { 'value' : 1 , 'index' : 6 , 'text' : 'January' } , { 'value' : 2 , 'index' : 7 , 'text' : 'February' } , { 'value' : 3 , 'index' : 8 , 'text' : 'March' } ] } ] } ]
777+ } ,
778+ texts : texts
779+ } ) ;
780+
781+ const rowsInfo = dataController . getRowsInfo ( true ) ;
782+
783+ assert . equal ( rowsInfo [ 0 ] . length , 2 ) ;
784+ assert . equal ( rowsInfo [ 5 ] . length , 3 ) ;
724785 } ) ;
725786
726787 // B234872
0 commit comments