@@ -908,6 +908,42 @@ QUnit.module('dxPivotGrid', {
908908 assert . equal ( $ ( '.dx-header-filter-menu' ) . find ( '.dx-list-item' ) . text ( ) , 'test <test>' , 'encoded' ) ;
909909 } ) ;
910910
911+ QUnit . test ( 'T1325377: Field panel operations should work after dataSource reassignment' , function ( assert ) {
912+ const assignedDataSource = new PivotGridDataSource ( {
913+ fields : [
914+ { dataField : 'region' , area : 'row' } ,
915+ { dataField : 'date' , dataType : 'date' , area : 'column' } ,
916+ { dataField : 'sales' , dataType : 'number' , summaryType : 'sum' , area : 'data' }
917+ ] ,
918+ store : [
919+ { region : 'North America' , date : '2013/01/06' , sales : 1740 } ,
920+ { region : 'South America' , date : '2013/01/13' , sales : 850 }
921+ ]
922+ } ) ;
923+
924+ const pivotGrid = createPivotGrid ( {
925+ allowSorting : true ,
926+ allowFiltering : true ,
927+ fieldPanel : {
928+ visible : true
929+ } ,
930+ dataSource : null
931+ } ) ;
932+ pivotGrid . option ( 'dataSource' , assignedDataSource ) ;
933+ this . clock . tick ( 500 ) ;
934+
935+ const $pivotGrid = $ ( '#pivotGrid' ) ;
936+
937+ $pivotGrid . find ( '.dx-area-description-cell .dx-area-field' ) . first ( ) . trigger ( 'dxclick' ) ;
938+ this . clock . tick ( 500 ) ;
939+
940+ $pivotGrid . find ( '.dx-header-filter' ) . first ( ) . trigger ( 'dxclick' ) ;
941+ this . clock . tick ( 500 ) ;
942+
943+ assert . equal ( pivotGrid . getDataSource ( ) . state ( ) . fields [ 0 ] . sortOrder , 'desc' , 'sorting changes current dataSource state' ) ;
944+ assert . ok ( $ ( '.dx-header-filter-menu' ) . find ( '.dx-list-item' ) . length > 0 , 'header filter has items' ) ;
945+ } ) ;
946+
911947 QUnit . test ( 'Field chooser inherits encodeHtml option' , function ( assert ) {
912948 const pivotGrid = createPivotGrid ( {
913949 dataSource : {
@@ -1044,7 +1080,7 @@ QUnit.module('dxPivotGrid', {
10441080
10451081 } ) ;
10461082
1047- QUnit . test ( 'T1317109: fieldChooser disposes on dataSource change' , function ( assert ) {
1083+ QUnit . test ( 'T1317109: FieldChooserBase internal _dataSource matches PivotGrid on dataSource change' , function ( assert ) {
10481084 const pivotGrid = createPivotGrid ( {
10491085 dataSource : {
10501086 rows : [ ] ,
@@ -1053,13 +1089,17 @@ QUnit.module('dxPivotGrid', {
10531089 }
10541090 } ) ;
10551091
1056- const disposeSpy = sinon . spy ( pivotGrid . _fieldChooserBase , '_dispose' ) ;
1057-
10581092 pivotGrid . option ( 'dataSource' , this . testOptions . dataSource ) ;
1059-
10601093 this . clock . tick ( 500 ) ;
10611094
1062- assert . ok ( disposeSpy . calledOnce , '_dispose was called once on dataSource change' ) ;
1095+ const fieldChooserBase = $ ( '#pivotGrid' ) . dxPivotGridFieldChooserBase ( 'instance' ) ;
1096+ const pivotDataSource = pivotGrid . getDataSource ( ) ;
1097+
1098+ assert . strictEqual (
1099+ fieldChooserBase . _dataSource ,
1100+ pivotDataSource ,
1101+ 'FieldChooserBase._dataSource must equal getDataSource() after dataSource change'
1102+ ) ;
10631103 } ) ;
10641104
10651105 QUnit . test ( 'not show field chooser popup on description area click when fieldChooser disabled' , function ( assert ) {
0 commit comments