Current filter:
                                You should refresh the page.
                                  • Hello,

                                    I have a customer requirement for dxPivotGrid to block the expand function of certain elements of row or column
                                    fields of the pivot grid. In the example below there is an element "REST" in each row field. For that element
                                    the expansion should be blocked for any method like manually clicking the item or activating the expanded flag
                                    of the row field. Is that possible? Would it be possible to hide the expand / collapse indicator for these elements as well?

                                    The attached image demonstrates that. The maximum expansion state of the pivot grid should be like the image on the right side.

                                    Best regards
                                    Matthias

                                    [JavaScript]
                                    <!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/19.1.4/css/dx.common.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/19.1.4/css/dx.light.css" /> <script src="./jszip.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular-sanitize.min.js"></script> <script type="text/javascript" src="https://cdn3.devexpress.com/jslib/19.1.4/js/dx.all.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js"></script> <script> var data = [ { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 2}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 213}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 3}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 19}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 31}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 99}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "50 ST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 456}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 23}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 3}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 1960}, { "pck": "8 G", "prd": "Prod01", "pzn": "PZN01", "testval": 730}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 507}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 142}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 64}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "50 ST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 209}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 28}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 239}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 62}, { "pck": "20 ST", "prd": "Prod02", "pzn": "PZN02", "testval": 5827}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 493}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 3}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 367}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 183}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 78}, { "pck": "50 ST", "prd": "Prod02", "pzn": "PZN03", "testval": 207}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 5}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "50 ST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 4}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 2}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 138}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 174}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 42}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 167}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 9}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 2}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 194}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 5}, { "pck": "35 G", "prd": "REST", "pzn": "REST", "testval": 61}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 353}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 53}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 38}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "50 ST", "prd": "REST", "pzn": "REST", "testval": 264}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 8}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "70 G", "prd": "Prod01", "pzn": "PZN04", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 14}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 7}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 54}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 3}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 4}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "50 ST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 4}, { "pck": "70 G", "prd": "Prod01", "pzn": "PZN05", "testval": 153}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 138}, { "pck": "50 ST", "prd": "REST", "pzn": "REST", "testval": 218}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 3689}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 93}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 766}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 6}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 4}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 3}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 2}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "2X50 G", "prd": "Prod01", "pzn": "PZN06", "testval": 54}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 36}, { "pck": "35 G", "prd": "Prod01", "pzn": "PZN07", "testval": 1844}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 3514}, { "pck": "50 ST", "prd": "Prod02", "pzn": "PZN08", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 13}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 44}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 94}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 152}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 2}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 76}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "20 ST", "prd": "Prod02", "pzn": "PZN09", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 4}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 318}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 18}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 2}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 4}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 5}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "100 G", "prd": "Prod01", "pzn": "PZN10", "testval": 1}, { "pck": "50 ST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "50 ST", "prd": "REST", "pzn": "REST", "testval": 2007}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 84}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 61}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 36}, { "pck": "35 G", "prd": "Prod01", "pzn": "PZN11", "testval": 2}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 2}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "50 ST", "prd": "REST", "pzn": "REST", "testval": 40}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 160}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 9}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 2}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "50 ST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 151}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 36}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 13}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 82}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "20 ST", "prd": "REST", "pzn": "REST", "testval": 2}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 1}, { "pck": "REST", "prd": "REST", "pzn": "REST", "testval": 0} ]; angular.module('myApp',['dx']) .controller('myController', function($scope) { $scope.pivotGridOptions = { allowExpandAll : true, showTotalsPrior : "both", dataSource : { fields: [ {dataField : "pck", area : "row", sortBySummaryField: "testval", allowSortingBySummary: true, sortOrder: 'desc', expanded: true }, {dataField : "prd", area : "row", sortBySummaryField: "testval", allowSortingBySummary: true, sortOrder: 'desc', expanded: true }, {dataField : "pzn", area : "row", sortBySummaryField: "testval", allowSortingBySummary: true, sortOrder: 'desc', expanded: true }, {dataField : "testval", dataType : "number", summaryType : "sum", area : "data"}, ], store: data }, }; }); </script> </head> <body ng-app="myApp" ng-controller="myController"> <div dx-pivot-grid="pivotGridOptions" style="width:600px; height: 1200px;"></div> </body> </html>

                                1 Solution

                                Creation Date Importance Sort by

                                Hi,
                                 
                                You can use the approach described at dxPivotGrid - Disable expanding and collapsing to disable the 'expand' action. As for the 'arrow' icon, you can remove it using the onCellPrepared event handler.
                                For instance, check the following example as a starting point - https://codepen.io/ArtemDevExpress/pen/KKPyaYj?&editable=true
                                 
                                Updated

                                The expanded option won't be efficient as it has effect for all cells that belong to a specific field.

                                You can use the expandHeaderItem/collapseHeader to expand/collapse specific fields.
                                See the modified example - https://codepen.io/ArtemDevExpress/pen/KKPyaYj?&editable=true

                                However, this approach won't be efficient if you need to expand/collapse multiple fields on the first load. You can complete this task using this approach from dxPivotGrid - The expandHeaderItem method doesn't work for collapsed columns.
                                The main idea is to use the internal PivotGrid state and change the columnExpandedPaths/rowExpandedPaths field.

                                Show all comments
                                • Matthias Döring 1 09.04.2019

                                  Hallo Artem,

                                  thank you but that does not solve the problem completely:

                                  - the expand/collapse blocking must be done just for some elements - in my example the elements with the name "REST".
                                  For that I have already found an approach.
                                  - the remaining problem is that the "REST" elements of my example are already expanded when the pivot grid is loaded. That happens
                                  because of the "expanded" property of their row fields. I need the flexibility to set the row /column fields either as expanded or
                                  not. But the "REST" elements should not expand in that case. Is there any possibility to collapse an expanded element programatically?
                                  I tried the "expanded" property of the pivot grid cell in onCellPrepared but that seems to be a read only property. Here is my current
                                  approach in onCellPrepared.

                                  Best regards
                                  Matthias

                                  [JavaScript]
                                  onCellPrepared(e) { if (((e.area === 'row') || (e.area === 'column'))) { if (e.cell.text.indexOf('REST') !== -1) { /* - attempt to collapse the element by setting the css classes - does not work e.cellElement.removeClass("dx-row-total"); e.cellElement.removeClass("dx-total"); e.cellElement.removeClass("dx-pivotgrid-expanded"); e.cellElement.addClass("dx-pivotgrid-collapsed"); */ // attempt to collapse the element with the expanded property - does not work e.cell.expanded = false; // hide the expand / collapse marker and disable the click event of the cell e.cellElement.html('<span>' + e.cell.text + '</span>'); e.cellElement.css({'background-color':'hsl(347, 100%, 90%)'}); e.cellElement.on('dxclick', function(event) { event.stopPropagation(); }); }; } }
                                • Artem (DevExpress Support) 09.04.2019

                                  Hi,
                                   
                                  The idea is to use the onCellClick event to prevent the "expand" action. Please take a closer look at the example I provided above. Let us know if this approach works on your side.

                                • Matthias Döring 1 09.05.2019

                                  Hello Artem,

                                  if you set the row field Region in your example to "expanded:true" then it does not work. As mentioned in my first comment the pivot grid should not expand these items (here Africa) even when the expanded property is set to true. All other items should of course behave as normal.

                                  Best regards
                                  Matthias

                                • Artem (DevExpress Support) 09.06.2019

                                  Hi Matthias,
                                   
                                  Please accept my apologies for the delayed response. The expanded option won't be efficient as it has effect for all cells that belong to a specific field.
                                   
                                  You can use the expandHeaderItem/collapseHeader to expand/collapse specific fields.
                                  See the modified example - https://codepen.io/ArtemDevExpress/pen/KKPyaYj?&editable=true
                                   
                                  However, this approach won't be efficient if you need to expand/collapse multiple fields on the first load. You can complete this task using this approach from dxPivotGrid - The expandHeaderItem method doesn't work for collapsed columns.
                                  The main idea is to use the internal PivotGrid state and change the columnExpandedPaths field.
                                   
                                  Try these suggestions and let us know your results.

                                • Matthias Döring 1 09.06.2019

                                  Hello Artem,

                                  thank you. I did not yet know the collapseHeaderItem function. Unfortunately as you mentioned it would just work for the top row field as wanted. What do you think about my following idea to solve the problem with collapseHeaderItem nevertheless. Basically I "misuse" the rowPath property of the data cells to achieve what I want. I did not yet check that in depth. At a first glance it seems to work. But maybe that could lead to performance issues with permanent looping the onCellPrepared or onContentReady events.

                                  Best regards
                                  Matthias

                                  [JavaScript]
                                  onCellPrepared(e) { if (e.area === "row" && e.cell && e.cell.text === "REST"){ e.cellElement.find(".dx-expand-icon-container").empty(); } // Must still be optimized. Needs just to run once for the first time // the grid is loaded. Not all REST cells need to be collapsed but just the // ones of the top REST element of a path. if ((e.cell.rowPath) && (e.cell.rowPath.length > 0)) { if (e.cell.rowPath[e.cell.rowPath.length - 1] === 'REST') { console.log(JSON.stringify(e.cell.rowPath)); e.component.getDataSource().collapseHeaderItem("row", e.cell.rowPath); } }; },
                                • Artem (DevExpress Support) 09.09.2019

                                  Hi,
                                   
                                  Yes, this approach may cause performance issues if the PivotGrid table contains a lot of fields. I recommend you thoroughly test it before running in production.
                                   
                                  As an alternative solution. I also recommend you consider the approach from the dxPivotGrid - The expandHeaderItem method doesn't work for collapsed columns thread.

                                • Matthias Döring 1 09.09.2019

                                  Hello Artem,
                                  thank you for your valuable assistance. I will check your alternative approach in depth. Mine seems to work as long as the data source has a reasonable size. With some 100.000 rows a got severe performance problems with virtual scrolling with it.
                                  Maybe it could be of interest for others. That's why  I add my current approach here.
                                  Best regards
                                  Matthias

                                  [JavaScript]
                                  in onCellPrepared: if ((e.cell.path) && (e.cell.path.length > 0)) { let restIdx = e.cell.path.indexOf('REST'); // check whether the element which is to block is in the path if ((restIdx !== -1) && (restIdx === (e.cell.path.length - 1))) { e.component.getDataSource().collapseHeaderItem(e.area, e.cell.path); // collapse the element if it should already be expanded e.cellElement.find('.dx-expand-icon-container').empty(); // remove expand/collapse indicator e.cellElement.on('dxclick', function(event) { // disable default click behaviour of cell (suppress expand / collapse) event.stopPropagation(); }); } }
                                • Matthias Döring 1 09.09.2019

                                  Hello Artem,

                                  I tried to get your recommended solution running but it does not yet work. Could you please check the following code and give me a hint whether I am on the right track.

                                  The idea to enumerate the expanded row paths I got from this ticket:

                                  https://www.devexpress.com/Support/Center/Question/Details/T353133/dxpivotgrid-how-to-expand-a-cell-programmatically

                                  The pivot grid does not show any reaction when setting the new state.

                                  Best regards
                                  Matthias

                                  [JavaScript]
                                  angular.module('myApp',['dx']) .controller('myController', function($scope) { var foreachTree = function(items, func, path) { path = path || []; for(var i = 0; i < items.length; i++) { path.push(items[i].value); func(items[i], path); if(items[i].children) { foreachTree(items[i].children, func, path); } path.pop(); } } let firstTime = true; function collapseSpecialElements(e) { if (!firstTime) { return; } firstTime = false; let ds = e.component.getDataSource(); let data = ds.getData(); // get all currently expanded row paths var expandedRowPaths = []; foreachTree(data.rows, function(member, path) { if (member.children) { expandedRowPaths.push(path.slice(0)); } }); // removes row paths which should not be expanded expandedRowPaths = expandedRowPaths.filter(rp => rp.indexOf('RESTEL') === -1); // set the state of the data source to just expand the admitted row paths let state = ds.state(); state.rowExpandedPaths.push(...expandedRowPaths); ds.state(state); }; $scope.pivotGridOptions = { allowExpandAll : true, showTotalsPrior : "both", dataSource : { fields: [ {dataField : "pck", area : "row", sortBySummaryField: "testval", allowSortingBySummary: true, sortOrder: 'desc', expanded: true }, {dataField : "prd", area : "row", sortBySummaryField: "testval", allowSortingBySummary: true, sortOrder: 'desc', expanded: true }, {dataField : "pzn", area : "row", sortBySummaryField: "testval", allowSortingBySummary: true, sortOrder: 'desc', expanded: true }, {dataField : "testval", dataType : "number", summaryType : "sum", area : "data"}, ], store: data }, onContentReady(e) { collapseSpecialElements(e); } }; });
                                • Artem (DevExpress Support) 09.10.2019

                                  Hi,

                                  Your code is correct. It's also necessary to change the "expanded" option value for all row fields.

                                  [JavaScript]
                                  let state = ds.state(); state.fields.forEach((f)=> { if(f.area === "row") f.expanded = false; });

                                  For instance, check the following example - https://codepen.io/ArtemDevExpress/pen/YzKaOYZ?editors=1010

                                  Let us know if this approach helps.

                                • Matthias Döring 1 09.12.2019

                                  Hello Artem,

                                  unfortunately the state based approach has a severe pitfall. It works well when the pivot grid is loaded. All special elements
                                  are collapsed and all other elements are expanded when the row field has the property expanded.

                                  But if you now collapse a row field (pck or prd) and expand it again by using its context menu the special elements are
                                  expanded as well. They are not "auto collapsed" because the function collapseSpecialElements is not called again in the onContentReady
                                  handler. If one removes the "firstTime" flag to run it every time when onContentReady is fired then you have probably the same performance
                                  trouble as with my first attempt to solve the problem in onCellPrepared with collapseHeaderItem.

                                  If you have another idea to that I would appreciate it. Currently I will use my first approach and warn the user if the data source
                                  gets so big that the feature would cause massive performance trouble. Maybe you could consider the introduction of
                                  some event based filter mechanism for checking whether an element should be expanded or not in a future release for such problems.

                                  Best regards
                                  Matthias

                                • Artem (DevExpress Support) 09.13.2019

                                   Hi Matthias,
                                   
                                  Thank you for the detailed explanation. You can override the default item's click event in the onContextMenuPreparing event handler and reset the "firstTime" variable.
                                  I've modified my previous example to demonstrate this idea- https://codepen.io/ArtemDevExpress/pen/YzKaOYZ?editors=1010

                                • Matthias Döring 1 09.13.2019

                                  Hello again,

                                  thank you. That could help. Then I would just have to pay some performance penalty when using the context menu's expand commands.
                                  Here some additional waiting time would be acceptable compared with the complete removal the first time flag or to my approach.

                                  I will try it again with your good idea. Maybe there are other functions as well which would require such a handling (for example re-organizing the cube with the field chooser).

                                  Best regards
                                  Matthias

                                • Artem (DevExpress Support) 09.13.2019

                                  You're welcome, Matthias. Let us know your results once you have had time to test it in a real project.