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

                                    I'm using the dxPivotGrid with a XMLA datasource (SSAS Service).

                                    I'm having difficulties manually expan ding paths.

                                    Here are some code snippets of different problems:

                                    problem 1:
                                    not working code (path not getting expanded):

                                    [JavaScript]
                                    onFieldsPrepared: function() { dxPivotGridDataSource.expandHeaderItem('column', ["&[2016]"]) }

                                    working code (path gets expanded):

                                    [JavaScript]
                                    onFieldsPrepared: function() { setTimeout( function(){ dxPivotGridDataSource.expandHeaderItem('column', ["&[2016]"]) } }, 3000 ) }

                                    explanation:

                                    without some large timeout, path is not getting expanded.

                                    problem 2:
                                    not working code (multiple sibling paths not getting expanded):

                                    [JavaScript]
                                    onFieldsPrepared: function() { setTimeout( function(){ dxPivotGridDataSource.expandHeaderItem('column', ["&[2016]", "&[2017]"]) }, 3000 ) }

                                    problem 3:
                                    not working code (hierarchy paths not getting expanded):
                                    the member 201601 representing january 2016, is the "son" of the member 2016 in the Cube hierarchy.

                                    [JavaScript]
                                    onFieldsPrepared: function() { setTimeout( function(){ dxPivotGridDataSource.expandHeaderItem('column', ["&[2016]", "&[201601]"]) }, 3000 ) }

                                    only solution i found for problem 3 was using multiple timeouts like this:

                                    [JavaScript]
                                    onFieldsPrepared: function() { setTimeout( function(){ dxPivotGridDataSource.expandHeaderItem('column', ["&[2016]"]) }, 3000 ) setTimeout( function(){ dxPivotGridDataSource.expandHeaderItem('column', ["&[2016]", "&[201601]"]) }, 6000) }

                                    Appreciate your response,
                                    Regards

                                1 Solution

                                Creation Date Importance Sort by

                                Hi,

                                The onFieldsPrepared handler is executed before the widget is fully rendered. This handler is not intended for changing UI. In addition, the expandHeaderItem works only for visible rows/columns. That's why the second approach doesn't work either.
                                Currently, there is no built-in setting that allows you to complete this task out of the box. However, we've researched this case and found that you can use an internal dxPivotGrid state to complete this task. The main idea is to change the columnExpandedPaths field and pass required values there. Please take a look at the following example - https://codepen.io/anon/pen/KXOpjM?editors=1010

                                Thanks,
                                Artem

                                • Barry Shaked 10.23.2017

                                  Thank you,
                                  I will explore this approach and let you know if it solved my issue.
                                  Regards

                                • Barry Shaked 10.25.2017

                                  Artem,

                                  I've checked your suggestion. it works only sometimes for some reason. you can also see this behavior in your codepen example - sometimes it opens the levels and sometimes not. could you please provide a stabler solution?

                                  Thank you

                                • Barry Shaked 10.25.2017

                                  using your code, If I deffer setting the state by a second it works good (though its a waste of a second for the user):

                                      setTimeout(function(){
                                        ds.state(state);
                                      }, 1000);

                                • Artem (DevExpress Support) 10.25.2017

                                  Hi Barry,

                                  It looks like it is early to fetch the client state in the onIntialized handler. Please try onContentReady instead - https://codepen.io/anon/pen/KXOpjM?editors=1010