I have a temporary state and a table tied to it. I'm trying to write a JS Code to add a new blank row to the temporary state table without changing any of the existing rows. I've been messing around with setValue and setIn but I can't get them to do this. Either I use setValue and it creates a new line AND clears out the entire table, or I use setIn and it doesn't create a new row but updates an existing one.
Can someone please help? Here's the table, I guess I'd want it to create a new row similar to the existing row, without affecting the existing row/s
but it seems to do something similar. Basically, any time I do a Temp_State_Detail.setValue, it adds a new row but reverts all lines back to their default state, clearing anything that was entered. I'm wondering if I should be interacting with the table instead of the Temp State?
Clicking the button adds a row but seems to wipe out anything already entered in the table. I'm not sure if this is similar to your experience or if I'm doing something wrong.
Basically, I want it so that when a user clicks the button to add a row, it leaves existing rows as they are, with any changes that had been entered into them, then it adds a new blank row set to "Part" Category.
Also, I think you may have to set the value of the table initially from a temp state so that you can run concat on it and this way it doesn't wipe out the original rows....so query1 in your case would be the initial temp state and then concat on that value and push it into another temp state which would be the value of the table itself
So, here's what I have done:
I have three temp states - each starting as objs that have structure but are empty - though they don't have to be.
mainTempState - this is the one I will use to update the db
Depending on what operation takes place, I will set temp1 to a value and then do
If I need to concat on that for temp2 I will do
Notice that I am never really changing but only adding to mainTempState...
For you mainTempState would be the value of your initial query and the source for your table.