I have a table with NestedRows plugin enabled. The table is initialized with hierarchical data.
I remove all rows: hot.alter('remove_row', 0, hot.countRows());
I add one row with nested rows.
I call hot.rerender()
I get Uncaught TypeError: Cannot read property '__children' of undefined
The expected behaviour was that this table shows only the one row with its children that was added after removing all previous rows.
See above and use the JSFiddle provided.
Hi @mpetris
Thanks for sharing. Can you explain me some details?
You want to:
Tip:
If we use hot.alter('remove_row', 0, 1); it will remove single parent with all children (not a single row).
If you want to change data you should use updateSettings or loadData stil... there is something wrong with loading data.
I will leave this issue for investigation.
Hi AMBudnik,
thanks for the quick response!
I tried loadData in my project. First with an empty array and then with an array of new data. This seems to work both there. The original goal was to replace all existing data with new (possibly empty) data. So loadData is what I needed. Thanks.
However, when I tried the JFiddle example at http://jsfiddle.net/6qhtp77q/ with
hot.loadData([]);
on button click it didn't work. I didn't get an error, but the first click on the button had no effect and the second removed all columns but the row label column. The row label column continued to show all rows from the initialization. See Demo at https://jsfiddle.net/faz7sp0g/
When I tried loadData with one row with children it seemed to had no visual effect. All rows and columns remained as initialized.
Hi AMBudnik,
I made a few more tests and it turned out that emptying the table in my project with
hot.loadData([]);
doesn't work flawlessly. The table isn't repainted after the loadData. Even a call to
hot.render();
doesn't help. The table in my project lives in a resizable area.When I resize that area, the table gets repainted and shows the changes of the data.
Note that when I leave everything as is and just switch nestedRows off then loadData does trigger the repaint even without a call to
hot.render();
@mpetris
Handsontable accepts an array of arrays or array of objects, so it is better to use hot.loadData([[]]);
@AMBudnik
Thanks for the hint, but conceptionally this doesn't make sense to me:
Since the NestedRows plugin requires an array of objects, I initialize Handsontable with an array of objects where a single object represent one row. An empty table would then be equivalent to an empty array without objects, hence []. But even in the case of an array of arrays data structure where one inner array represents one row, [] would represent an empty table, i. e. "no rows". [[]] instead means "one row with no column values", which is quite different.
When trying hot.loadData([[]]) with the example from above https://jsfiddle.net/faz7sp0g/ the behaviour is still faulty but somewhat more consistent with the "no column values" aspect: A click on the button removes all columns but the row label column. The number of rows is unchanged. A notable difference is that hot.loadData([[]]) shows this behaviour right on the first click and hot.loadData([]) needs a second click.
I agree, changing a single array to array of arrays still does not fix the issue.
I've marked this issue as a 'assistance needed' as I wasn't able to further investigate the issue by my own.
Any update on this issue ?
Hi @marc-antoinepelletier
We do not have the following issue on our Roadmap for April. To stay up-to-date with our tasks you can check this site https://trello.com/b/PztR4hpj/handsontable-roadmap-2017-login-to-vote and leave your vote for favorite features or fixes.
Issue still replicable in v 1.14.2 http://jsfiddle.net/3bp3oy03/
Inform Gr # 17081
The issue stays the same in v5.0.1

To add more insights to this issue, we have the same behaviour if you start with empty data array and then load the data via loadData when it's available:
https://jsfiddle.net/v9jxpmg0/
On the same order of things, if you load initial data but then load another set of data (with same structure) via loadData, the data is not updated:
https://jsfiddle.net/tb2jw1hs/2/
I found a workaround which consists in disabling the nestedRows plugin, load the data, enable the plugin again and then load the data one more time.
I guess it comes from the cache of the DataManager which doesn't get updated correctly:


Hope it'll help 馃檪
Update for 7.1.1 (the same for 8.0.0-rc1 build 26/09/19).
Updated demo https://jsfiddle.net/handsoncode/b1cdq8m0/
Fixed with https://github.com/handsontable/handsontable/pull/6015
@AMBudnik The issue wasn't solved after all?
Yes, it is solved with the latest build but as it hasn't been released yet we'd like to keep it opened.
@frankie567 new version 7.1.27.2.0 fixed described here issue and will be released in next week.
Forked from the first case in (https://github.com/handsontable/handsontable/issues/3914#issuecomment-470844376) https://jsfiddle.net/aninde/5a109gso/
@frankie567 could you confirm if this is result as you expected?
Forked from the second case in above comment and fixed in 7.1.27.2.0 https://jsfiddle.net/aninde/1dqceLwj/
Updated demo in 7.1.27.2.0v. https://jsfiddle.net/aninde/g963kvmt/ - still works in new version.
@aninde
@frankie567 that will be fixed by an even newer version 8.0.0-rc1. We have moved this problem to another issue, so as not to get lost in the releases. Check out the fixed result in a https://github.com/handsontable/handsontable/issues/6339#issuecomment-542136688
We currently testing the new release candidate 8.0.0-rc1 with many breaking changes.
I recommend observing news from issue #5751. More about changes in the PR #5945.
We plan to release 8.0.0-rc1 at the turn of October and November.
Reopening. Partially it was solved and linked to 7.2.0 version in #6339.
As mentioned by @aninde second part will be fixed with v8.0.0 and it's when this issue should be closed.
Hey @mpetris @frankie567
We've just released version 8.0.0-beta1 where this issue is fixed http://jsfiddle.net/pz4gyc1x/
As this is only a beta now we do not recommend using it on the production. However,
we wanted to share the version for you to test so any comment highly appreciated 馃憤
Hey @aninde
it doesn't work on my mac https://jsfiddle.net/8L031ymd/
all options are fine besides
Can you check?
@AMBudnik this is by design, so I will change the title of the issue.
We reported it here
https://github.com/handsontable/handsontable/issues/6324
https://github.com/handsontable/handsontable/issues/5901
Described here problem was separate on two issues. Part 1 - is fixed by 7.2.0 https://github.com/handsontable/handsontable/issues/3914#issuecomment-540635243
Part 2 - is fixed by 8.0.0-beta1 https://github.com/handsontable/handsontable/issues/6339
http://jsfiddle.net/p912zct5/ still broken in 8.0.0.-beta2-rev6
The main case works the same in v 8.0.0 http://jsfiddle.net/mz2f1j7x/ (NOT FIXED)
This issue was not solved for v 8.0.0 https://github.com/handsontable/handsontable/issues/7138 nor its betas.
Most helpful comment
To add more insights to this issue, we have the same behaviour if you start with empty data array and then load the data via
loadDatawhen it's available:https://jsfiddle.net/v9jxpmg0/
On the same order of things, if you load initial data but then load another set of data (with same structure) via
loadData, the data is not updated:https://jsfiddle.net/tb2jw1hs/2/
I found a workaround which consists in disabling the
nestedRowsplugin, load the data, enable the plugin again and then load the data one more time.I guess it comes from the
cacheof theDataManagerwhich doesn't get updated correctly:Hope it'll help 馃檪