Author Topic: Avoid blinking  (Read 6205 times)

devspec

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 8
    • View Profile
Avoid blinking
« on: November 24, 2017, 07:07:03 pm »
As you suggested me here, I reload data and refresh the whole grid:

Code: [Select]
setInterval(function () { ReloadList() }, 5000);

function ReloadList() {
  $.getJSON("/api/Parse/TasksList?type=0&page=&api_key=", function (data) {
    $grid.pqGrid('option', 'dataModel.data', data.data);
    $grid.pqGrid('refreshView');
  });
}

But every 5 seconds selected cell is blinking - I recorded the video, you can see this behaviour here on youtube.
And if a cell selected on top of a table and I scrolled a page down, every 5 seconds page scrolls by her own to selected cell position. I also recorded it and you can see it here.

So, the questions are:
1. How to avoid blinking of selected cell during grid refresh?
2. How to avoid upscroll of page to selected cell during grid refresh?

Thank you
« Last Edit: November 24, 2017, 07:14:22 pm by devspec »

devspec

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Avoid blinking
« Reply #1 on: November 24, 2017, 08:47:19 pm »
Oh, I found another one important problem: every 5 seconds (when I refresh grid) all checked checboxes becames unchecked.
Video is here

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6087
    • View Profile
Re: Avoid blinking
« Reply #2 on: November 26, 2017, 12:24:08 pm »
In your previous post you mentioned the requirement to refresh remote data in grid every 5 seconds, which is normally done for read only data. So I proposed solution based on refreshView()

In this post, you want the user to make changes in the grid at the same time which implies there are 2 simultaneous independent data sources for the same grid. Naturally one data source is going to overwrite the changes from other data source.

Can you please elaborate what you are trying to do.
« Last Edit: November 26, 2017, 12:30:26 pm by paramquery »

devspec

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Avoid blinking
« Reply #3 on: November 26, 2017, 04:29:48 pm »
Ok, I elaborate SAAS-service with behaviour like:
1. User adds to queue new long-running task with progress reporting. It looks like: http://joxi.ru/BA0pZydSJjDBbA
2. The service in background do this task and reports progress to user. Every 5 second data from server reloads and change appears in right places - in columns with progress, summ etc.
3. User can check checkbox near this task or other tasks and delete it or export it's results during any task execution
Now it works with Knockout table, but it's not very comfortable for me as a developer to work with it.
So, the main question is: how to refresh pqgrid according to only changed data?
As an example:
- if user add one task - only first row appears and the last row goes to second page (if pagination).
- if data in JSON from server was changed only in "progress" field - only a "progress" cell of according row need to be changed.
I think, it's very useful option - it's redundantly to refresh all the table if only one cell really needs to be refreshed.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6087
    • View Profile
Re: Avoid blinking
« Reply #4 on: November 27, 2017, 06:30:10 pm »
I've put together a demo for selective refresh of cells based on refreshCell method.

https://paramquery.com/pro/demos/refreshCell

You would need to compare the remote data with data in grid to find out the changed cells.

devspec

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Avoid blinking
« Reply #5 on: November 27, 2017, 07:01:35 pm »
Yes, I thought about that.
But it's very hard work - to consider all the possible moments like - adding one task, adding several tasks, deleting task, deleting several tasks etc.
Maybe you, as owner of the grid, can develop a method like refreshPartially or refreshChanges that will refresh only changed data in grid in view of pagination and so on?
I think, it will be very useful method for everyone.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6087
    • View Profile
Re: Avoid blinking
« Reply #6 on: November 28, 2017, 01:21:05 pm »
Ok, I'm moving it to feature request board, would check and analyze how it can be simplified.

devspec

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Avoid blinking
« Reply #7 on: March 22, 2018, 02:41:37 pm »
Hi! Is this implemented in any way?