ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: kadyrsizov on August 30, 2019, 12:53:15 pm

Title: Pivoted grid fails refresh
Post by: kadyrsizov on August 30, 2019, 12:53:15 pm
Hi there

I've implemented grid which uses rows and cols grouping (pivot mode) with remote data model. When I call refreshDataAndView method grid's view doesn't render updated data and displays empty view

Example:
http://jsfiddle.net/kL0gbav9/12/
Just press RefreshDataAndView button

What is the correct way to refresh data and view in the pivot mode?
Title: Re: Pivoted grid fails refresh
Post by: paramvir on August 30, 2019, 04:50:47 pm
Thanks for sharing jsfiddle.

Turn off pivoting before refreshDataAndView()

Code: [Select]
listener: function (evt) {
     this.Group().option({on:false, pivot: false})
     this.refreshDataAndView();                           
}

and recreate pivot in complete event

Code: [Select]
complete: function(){
       this.Group().option({pivot: true, on: true})
},

https://jsfiddle.net/4eakqptm/
Title: Re: Pivoted grid fails refresh
Post by: kadyrsizov on August 30, 2019, 06:23:24 pm
Thanks for the solution!

In my implementation user has ability to switch between pivot mode and not pivot mode dynamically and I can't enable pivot mode every time when complete event fires. Now I have to use some flag to manage this situation.
Is it possible implement this feature into the grid's core in next versions?
Title: Re: Pivoted grid fails refresh
Post by: paramvir on August 30, 2019, 07:20:00 pm
No need to use a global flag. complete event handler can be written inside the listener itself.

Code: [Select]
listener: function (evt) {
                var on = this.option('groupModel.on'),
                            pivot = this.option('groupModel.pivot');

                this.Group().option({pivot: false, on: false})
                        this.refreshDataAndView();               

                        this.one('complete', function(){
                            this.Group().option({pivot: pivot, on: on})
                        })
}


https://jsfiddle.net/9bon57we/
Title: Re: Pivoted grid fails refresh
Post by: kadyrsizov on August 30, 2019, 09:35:31 pm
Good idea! Thanks