mleibman / SlickGrid

A lightning fast JavaScript grid/spreadsheet
http://wiki.github.com/mleibman/SlickGrid
MIT License
6.81k stars 1.98k forks source link

Calling setItems() method grid is rendering twice internally. #1143

Open ghost opened 7 years ago

ghost commented 7 years ago

When I am adding rows using 'setItems()' method it triggers the following events:

  1. onRowCountChanged
  2. onRowsChanged

Both the events calls the render method. So this makes the grid to render twice, instead of it should be rendered once.

As we know that setItems() method always calls the above mentioned events in the defined order, then we can remove the render method call from the onRowCountChanged event.

So, need to know will removing this from onRowCountChanged event will resolve the problem or it will break in some other case. Please confirm or suggest a better approach to resolve the same.

The following is the link of the implementation used in our code: DataView

Please reply ASAP.

6pac commented 7 years ago

There have been posts about this before. Having the two events is not ideal, but that's the way the grid is for now. The render() method is differential, so calling it a second time, while clearly better if avoided, basically does nothing if the rows are the same as before. The overhead will be small.