Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance issue with instance.setDataAtCell() #1061

Closed
zallarak opened this issue Sep 25, 2013 · 5 comments
Closed

Performance issue with instance.setDataAtCell() #1061

zallarak opened this issue Sep 25, 2013 · 5 comments

Comments

@zallarak
Copy link

For a loop like this that has ~500 rows, it takes almost 2 seconds to set boolean values. Is there a way you'd recommend to do something like this with less lag)

// sets all checkboxes to true in first column
for (var i = 0; i < handsontableInstance.countRows(); i++) {
  handsontableInstance.setDataAtCell(i, 0, true);
}

Thank you

@psmolenski
Copy link
Contributor

Have you tried using loadData to update multiple cells at once?

@warpech
Copy link
Member

warpech commented Oct 1, 2013

You have 4 options:

  1. use plain JavaScript to manipulate the same object that was given as the data source, then call render
  2. use populateFromArray to change multiple cells using array as input (see docs)
  3. use loadData to load a new data source
  4. use setDataAtCell to change single cell values (SLOW - rerenders table after each call)

I think that options 1 and 2 are optimal for your case.

@AMBudnik
Copy link
Contributor

AMBudnik commented Apr 2, 2015

I assume this issue can be closed in lack of other questions.

@AMBudnik AMBudnik closed this as completed Apr 2, 2015
@Rex90
Copy link

Rex90 commented Sep 20, 2016

Is there a way to disable the rendering while using setDataAtCell ()? Its really convenient for my app to use this function but I am suffering from some serious delays. @AMBudnik @warpech

@AMBudnik
Copy link
Contributor

Hi @armensg setDataAtCell triggers the render to refresh the table and show new content. If you are loading more data sometimes it is better to use the loadData method instead.

Here's a basic demo where you are able to compare loadData with setDataAtCell : http://jsfiddle.net/1kruLmjo/ Basically this one is easy to achieve with loadData as I'm changing only the first column but the case is to show different level of performance for those two methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants