ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: Jignesh on December 18, 2019, 12:22:36 pm

Title: Without Page refresh column(Title and count) changes with data.
Post by: Jignesh on December 18, 2019, 12:22:36 pm
Hi Paramvir,

Project file is bigger so I have sent attachment by wetransfer and sent mail by cherish.patel@convergesolution.com.

I have sent demo zip file for PQGrid Page by “Wetransfer”.

PQGrid demo Path Like: “/Test/Index”

Description: I have set 2 buttons for “Gird1” and “Grid2”.
       When Grid1 button click then Page refresh and set 4 columns with data.
       When Grid2 button click then Page refresh and set 3 columns with data.

Issue: How can I change columns in same page and same gird without page refresh ?

Please give me some solution for same and let me know if any query for demo project.

Thank you,
Cherish Patel
Title: Re: Without Page refresh column(Title and count) changes with data.
Post by: paramvir on December 18, 2019, 03:01:29 pm
It's simply a matter of switching colModel

In click handler of first button.

Code: [Select]
grid.refreshCM( colModel1 );
grid.refresh();

And in click handler of 2nd button.

Code: [Select]
grid.refreshCM( colModel2 );
grid.refresh();

https://paramquery.com/pro/api#option-colModel

https://paramquery.com/pro/api#method-refreshCM
Title: Re: Without Page refresh column(Title and count) changes with data.
Post by: Jignesh on January 07, 2020, 01:08:23 pm
Hi Paramvir,

I have put below code after save grid but data not refreshed after success.

grid.refreshCM( colModel1 );
grid.refresh();



I have also tried below code for data refresh:

  data = JSON.parse(jsonData);
  obj.dataModel = { data: data };
  grid.pqGrid(obj); (get error like .pdGrid is not function)



then after I tried below code which use same in first time grid bind.
  grid = pq.grid("#dndgrid", obj);
  pq.grid('refreshDataAndView', obj);
but error occurred. And data not refreshed .



Please help me on this.

Thank you,
Jignesh
Title: Re: Without Page refresh column(Title and count) changes with data.
Post by: paramvir on January 07, 2020, 04:40:44 pm
Previous reply was for resetting new colModel in grid.

To reset new data in grid, please use this:

Code: [Select]
//setter
grid.option( "dataModel.data", dataSales );
//setter of dataModel.data is followed by refreshDataAndView method call.
grid.refreshDataAndView()

https://paramquery.com/pro/api#option-dataModel-data