ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: joaosales on January 12, 2018, 06:32:00 pm

Title: Refreshing columns and data
Post by: joaosales on January 12, 2018, 06:32:00 pm
Hi, I have a grid that shows data for some items during the a year and a text field and 2 buttons to change the years like the attachment.

When i either click one of the buttons or type the year it will refresh the table data and columns to reflect the chosen year.
But the way i'm doing it it is updating the colModel, but the columns are not being updated and so the groupheader of the grid still showing the year that is loaded, am i missing something?
Here is the code for the table update of the colModel, the buildColumnModel method only creates a new array setting a new parent named after the new year and the 12 columns for each month.

Code: [Select]
var $filterText = this.toolbar().find(".filterValue"),
                            oldVal = Number($filterText.val());           
                        $filterText.val(--oldVal);
                        let date = new moment().year(oldVal);
                        date = date.startOf('year');
                        this.colModel = buildColumnModel(date, true);
                        this.option( 'colModel', grid.option( 'colModel') );
                        this.refresh();

Thanks,
Title: Re: Refreshing columns and data
Post by: paramvir on January 12, 2018, 10:39:21 pm
you can't assign colModel to grid like this.

this.colModel = buildColumnModel(date, true); it is incorrect.

Assuming you want to update whole colModel with buildColumnModel(date, true)

Code: [Select]
this.refreshCM( buildColumnModel(date, true) );
this.refresh();
Title: Re: Refreshing columns and data
Post by: joaosales on February 19, 2018, 10:22:11 pm
Hi, im with a problem related to what i was doing here
I fixed to use the refreshCM and it worked like planned. But I have now a checkbox column mapped to true/false values
Code: [Select]
{
                title: "Total",
                dataIndx: "sumRow",
                type: 'checkbox', //required property.
            }

and every time i use the buttons that refresh the colModel the column stops being a checkbox and only show true and false values.
Title: Re: Refreshing columns and data
Post by: paramvir on February 20, 2018, 10:56:38 am
Checkbox column can't be added or removed dynamically, it should be predefined in the initial colModel.

It can only be hidden/ made visible after initialization.

If you are still facing issues, please share a jsfiddle/ plnkr.
Title: Re: Refreshing columns and data
Post by: Digitalsoft on March 11, 2021, 06:30:58 pm
Is the above issue fixed or it is still an open issue in PQ grid, We are having a similar requirement like this
Title: Re: Refreshing columns and data
Post by: paramvir on March 11, 2021, 06:46:52 pm
Checkbox column can be added or removed dynamically in recent version.