Call loadedRows() event

Posted by: sravya_tamma on 2 June 2020, 11:34 pm EST

  • Posted 2 June 2020, 11:34 pm EST

    Hello,

    I have an auto expand/collapse feature. Auto collapse/expand brings back the subtotal rows for some of the columns. I would like to call loadedRows event to hide the subtotals in some of the columns.

     expandCollapse(e: MouseEvent) {
            if (this.isCollapsed) {
                this.pivotGrid._collapseColsToLevel(10000);
                this.pivotGrid._collapseRowsToLevel(10000);
                this.isCollapsed = !this.isCollapsed;
            } else {
                this.pivotGrid._collapseColsToLevel(1);
                this.pivotGrid._collapseRowsToLevel(1);
                this.isCollapsed = !this.isCollapsed;
                //Below line doesn't work. How can i call the loadedRows 
    	     this.loadedRows(this.pivotGrid);
            }
    
        }
    
    

    Thanks,

    Sravya

  • Posted 3 June 2020, 3:58 am EST

    Hi Sravya,

    You may raise the loadedRows event by calling the onLoadedRows method:

    this.pivotGrid.onLoadedRows()
    

    But, before this, can you explain why do you need to call the loadedRows event. The better option will be to create a different method with all the processing that you have done in loadedRows event and call this method instead of the event itself.

    Regards,

    Ashwin

  • Posted 3 June 2020, 2:39 pm EST

    Hi Ashwin,

    Yup i created different method and resolved it. Thanks

    One more question:

    In pivot grid (olap) I have the grid sorted in descending order . But, when I apply filter, I loose this sort order. May I know what is the event that i can call to maintain this sort order on Filter Change ?

  • Posted 4 June 2020, 5:24 am EST

    Hi Sravya,

    We are sorry but there is not event that fires only when the filter changes. There is an event of PivotEngine, viewDefinitionChanged but it will fire after each change in the pivotView like moving fields, filtering, etc. Moreover, you cannot reassign the sort on the PivotGrid from JS. So, even if there was a filter applied event, the sorting cannot be done.

    ~regards

  • Posted 8 June 2020, 5:27 pm EST

    ok.

    Question: When ever the filter is applied I would like to collapse my grid. I would like to know how this can be done using viewDefinitionChanged event ?

    I added an event handler and i see this is being called when filter is applied. But this code is not collapsing the grid.

    Can this be done this way ? If so, what am i missing here ?

    this.ng.viewDefinitionChanged.addHandler(() => {
                        this.pivotGrid._collapseColsToLevel(1);
                        this.pivotGrid._collapseRowsToLevel(1);
                    });
    
  • Posted 9 June 2020, 1:07 am EST

    Hi Sravya,

    We are unable to replicate the issue at our end. Please refer to the sample link below that we used to replicate the issue:

    https://stackblitz.com/edit/js-43uzae

    Can you please let us know whether we are missing something in order to replicate the issue? Also, can you check whether there is any error thrown in the console and also check whether this event is being raised or not.

    ~regards

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels