[GL #153] Extra row added after refresh data

Tags: #<Tag:0x00007efc653ae608> #<Tag:0x00007efc653ae4c8>

Hi everyone,

I am currently using ng-handsontable.

I have configured the handsontable to have one min spare rows, it is working fine if I didn’t reload my data.

Recently, I am having a requirement to reload the data from a REST service, when the data come back from the server i am using hotInstance.updateSettings({data: data}); to update the data into datasheet. Then there will always an extra row in my datasheet.

Below are the screenshot of the table.

When first time load the data into handsontable, a spare row was added as expected.

Then trigger REST service again to Re-load data into the Handsontable.
Code are using to update the data hotInstance.updateSettings({data: data});

Then row 7 was added and it is unwanted behavior.

I already checked my data, it doesn’t have the empty row record.
Thank you in advance for any help you can provide

Hi @kent.tan0214
Could you take a minute to create a demo? You can run a simple function that will load the data - It doesn’t need to be a server call.

From your images it looks like you’re loading another set of data, right? In the first image there was a table with 7 rows and the 2nd image has a table with 19 rows.

I will try to create one in the later time.

Yes, I am trying to load another set of data which contain more rows.

I made an example: http://jsfiddle.net/12k933zf/

when I replace the first data with the other data

hot.updateSettings({ 
  data: extra
})

or add new data to exiting data (concat)

hot.updateSettings({
  data: total
})

in both cases we have only one spare row - at the end.

Sorry, I think I have forgot to mention that I am using PRO version with Filter enable.

I made an example to reproduce the problem.

http://jsfiddle.net/kent0214/oxygdvga/14/

Yup, that changes everything @kent.tan0214 :slight_smile:
Now I can also reproduce it with my Vanilla JS example:
http://jsfiddle.net/12k933zf/1/

I added this case in our internal ticketing system. (#59)
Thanks for sharing

Thanks.

May I know when will this bug get fixed?

Hi @kent.tan0214
There’s no deadline for this issue yet but this issue will get updated as soon as the works starts,

Hey @kent.tan0214, you can use this tweak
At the time of loading newdata just set minSpareRows to false, and after loading data again set it to true.

hot.updateSettings({
    minSpareRows: false, 
    data: newdata
});
hot.updateSettings({
    minSpareRows: true
});

thank you for your input @ankushgoel

today we are planning to have a team meeting where we will plan new tasks for Q2 and one of the propositions was to recreate the minSpareRows and fixedRowsBottom structure.
Please check our Roadmap for updates: https://trello.com/b/PztR4hpj/handsontable-roadmap-2017-login-to-vote
I highly encourage to leave your vote for the favorite fixes/features as well.

Issue still present in v 1.10.2, reported at GL#153

issue still present in v1.13 of Hot Pro.
I hade the same issue when loading data from an ajax call on page load, the fix :

jQuery.ajax({
type: "GET",
url:'{{ path("load_data") }}',
dataType:'json'
})
 .done(function (data) {
    if(data.data) {
        hot1.updateSettings({
            data: JSON.parse(data.data),

        });

    }

})
.always(function(){
    hot1.updateSettings({
        minSpareRows: true
    });
});

this Issue still present in Pro 5.0.0.
May I know when will this bug get fixed?

Hi @dylanyin

please track progress on this issue at https://github.com/handsontable/handsontable/issues/3937

Hey there,
I was facing the same issue. But in my case there were empty rows in between the table not at the end.
In order to overcome it, before updateSetting I stringified the JSON object and assigned its parsed value to data attribute.
And It Worked!!

var listData = JSON.stringify(jobListData);
hot.updateSettings({
 data: JSON.parse(listData)

});

Cause for this issue might be value pass by reference for data attribute of hot table.

Thanks!

Thank you for your feedback @manjushamule7

This issue is fixed with version 8.0.0-beta1 http://jsfiddle.net/w87rjc0b/
As it’s beta we highly encourage to test it and share your feedback

Hi aleksandra… has this issue been solved somewhere else ? I trying with the example you provided at http://jsfiddle.net/w87rjc0b/ but whenever values are added to the dataSchema, to reflect default values as when adding new rows, the table adds 2 more rows, actually whenever any cell is edited-refreshed 2 rows are added to the bottom… what is the best way to set default values-formulas for new rows ??

Hi @adonisbriceno

that was the purpose of this example - to add 2 spare rows (minSpareRows: 2). This option is added in the 363 line of the example.

45