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