Author Topic: Without Page refresh column(Title and count) changes with data.  (Read 2248 times)

Jignesh

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 46
    • View Profile
Hi Paramvir,

Project file is bigger so I have sent attachment by wetransfer and sent mail by [email protected].

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

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Without Page refresh column(Title and count) changes with data.
« Reply #1 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
« Last Edit: December 18, 2019, 03:07:48 pm by paramvir »

Jignesh

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Without Page refresh column(Title and count) changes with data.
« Reply #2 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

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Without Page refresh column(Title and count) changes with data.
« Reply #3 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
« Last Edit: January 07, 2020, 04:48:22 pm by paramvir »