Author Topic: How do I refresh the data in paramquery grid  (Read 7232 times)

[email protected]

  • Newbie
  • *
  • Posts: 5
    • View Profile
How do I refresh the data in paramquery grid
« on: May 11, 2016, 10:56:41 am »
Hi,
How do I refresh the data in paramquery grid,
I have a select option which will change the data to be displayed in the grid .
 for example there are 10 rows of data in first option click and 5 rows data in second option click and 15 rows of data in third option click.
It is displaying the records fine if the option we select  is for first time.

If first option is selected 10 rows are being displayed.
But if we select now the second option in select we are getting only those 5 rows of data.But instead of displaying 5 rows in grid It is appending these 5 rows to the previous 10 rows by replacing 5 rows in them with new data and showing only 10 rows.
Now if we select third option the whole data is being overridden and 15 rows are being displayed as desired because 15 rows are here which are replacing only 5 rows.

The problem arises as I said only when the later option gives less no.of rows when compared to the earlier option.
I have used $grid.pqGrid("refreshDataAndView") but no of use .
How do I solve this ??
Thanks
Bhanu Prakash

[email protected]

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: How do I refresh the data in paramquery grid
« Reply #1 on: May 11, 2016, 11:15:43 am »
even If there is no data on second option click the grid is displaying the first option related data itself .

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: How do I refresh the data in paramquery grid
« Reply #2 on: May 12, 2016, 11:28:56 pm »
you haven't mentioned how you assigned data to the grid.

It can be done as:

$grid.pqGrid( 'option', 'dataModel.data', new_data );

Then it can be followed with refreshDataAndView().

If you face any issues, please share a jsfiddle http://jsfiddle.net/pb5kpred/

[email protected]

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: How do I refresh the data in paramquery grid
« Reply #3 on: May 19, 2016, 12:03:35 pm »
Thank you very much
after looking at your JSfiddle i found my mistake.
I have been doing the same silly  mistake for a long time
I amusing the same data object to reload the data in the grid without clearing the previous data in the data object.So the new data is appending to the previous one.
Just i cleared the previous data object before loading it with new one from the database.