I am using NGHandontable datagrid. I am facing one problem that it I am not finding its row Change event. I need it because If I save data on afterchange event in database table, then server will get hit on every cell change which can cause performance problem.
So I want to hit server on row change event so that it will get hit after all the changes are done for a row.
Please help me with some suggestion or work around of this problem.
The afterChange hook fires for a single cell and takes its coordinates. If you wish to do some actions after a specific row has been changed you can use the first parameter of the hook. Here is a working example http://jsfiddle.net/handsoncode/qckxqgef/
Thanks for your response with the answer. But as per my understanding there will be a problem in this solution.
That is suppose I am changing some data in row 0.after doing some changes I select the next row (row1 ) to call the method of update data in server side but I will not be able to call it (by clicking) as the afterchage will get fire only after I make change on the current row (row1 ) .
Please let me know If there is any Misunderstanding from my side or need any clarification about my question
Thanks for your response. We have decided to save the data on after change. so I think the Issue is resolved for now .
But I am facing One more Problem that is I am using redux for state management, when I am editing data in handsontable the store is getting updated automatically. If I am cloning the data its also updating the clone also. but I don’t want the store to be Mutable.
after some debugging I saw that “setDataAtCell” function is responsible for this issue.
I you kindly help for solving this problem I will be really Thankful to you. If you face any problem in understanding Please let me know.
Yes, unfortunately, it happens as the setDataAtCell() even if added for a single cell turns on the process of re-rendering. Currently in Handsontable when we change a single value whole table (each cell) gets re-rendered.
We are planning to add a possibility to re-render only a single cell but this process would take a lot of time and testing. It is called eco-rendering.
I understand the re rendering issue but I still don’t understand why its updating the values of my main variable. I am describing the Problem.
if (data !== null) {
vData = _.clone(data);
this.HtLoadData(vData);
}
Here you can see that I am making clone of the data and storing it in vData(clone variable). When I am changing data in grid It should update the Vdata but its also updating the data which is in data variable (main variable).
I don’t understand that how its getting the reference of the of my main variable(data ). Isn’t there any way out so that we can stop the referencing and updating the data of my main variable(data )
If You want we can create a test scenario and check it in the JSFiddle.