Author Topic: Refresh summarydata cell  (Read 5156 times)

billybraga

  • Newbie
  • *
  • Posts: 5
    • View Profile
Refresh summarydata cell
« on: May 12, 2016, 11:56:20 pm »
1. Why postRender isn't called for summary cells ?
2. Why can't I call refreshCell for a summary cell ?

I am using the summaryData option to render a summary at the bottom of my grid and I want to manually refresh some of those cells at specific moments.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6122
    • View Profile
Re: Refresh summarydata cell
« Reply #1 on: May 13, 2016, 09:41:44 am »
Set the summaryData option whenever you want to refresh whole or part (cells) of summary rows.

Code: [Select]
grid.option( 'summaryData', new_summary_data );

Example: http://paramquery.com/pro/demos/summary
« Last Edit: May 13, 2016, 10:55:09 am by paramquery »

billybraga

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Refresh summarydata cell
« Reply #2 on: May 13, 2016, 04:44:15 pm »
So what you propose is to do this ?

Code: [Select]
$("#grid").pqGrid("summary", "summaryData", [ { property: value } ])
It doesn't seem to re-render the summary cell(s).

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6122
    • View Profile
Re: Refresh summarydata cell
« Reply #3 on: May 13, 2016, 05:55:10 pm »
Please share a jsfiddle so that I can look into it.

billybraga

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Refresh summarydata cell
« Reply #4 on: May 13, 2016, 07:39:13 pm »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6122
    • View Profile
Re: Refresh summarydata cell
« Reply #5 on: May 17, 2016, 02:35:05 pm »
Grid requires a refresh after summary data is assigned from an external function.

http://jsfiddle.net/kqag7bvh/

billybraga

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Refresh summarydata cell
« Reply #6 on: May 17, 2016, 04:49:40 pm »
That is exactly what I am trying to avoid. I don't want to repaint the grid each time something changes in the summary.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6122
    • View Profile
Re: Refresh summarydata cell
« Reply #7 on: May 17, 2016, 05:35:03 pm »
Quote
I don't want to repaint the grid each time something changes in the summary.

May I know the reason?

Normally the summary data is dependent upon data in the grid, so when data changes in the grid ( typically due to editing or filtering ), grid main data and summary data are shown/ refreshed in a single repaint and repaint of the grid is quite fast in virtual mode.

Anyway the ability to repaint only the summary table can be get from createTable() API.

http://paramquery.com/pro/api#method-createTable

and if you are still not content and want the full infrastructure of main grid like postRender and refreshCell, you could probably use link scrolling to show summary grid underneath the main grid.

http://paramquery.com/pro/demos/scroll

billybraga

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Refresh summarydata cell
« Reply #8 on: May 17, 2016, 05:39:17 pm »
The reason is that I am integrating knockoutJS in the grid. The cells are knockout templates bound to javascript objects containing knockout observables. Their content are automatically updated by the knockoutjs library and I refresh only the parts of the grid I need depending if the cell height changes. The summary cells are also bound to knockout observables so I would like to refresh them individually to avoid rebinding each and every cell of the grid to their knockout template and context.

I'll look into the links you provided.