You need to sign in to do that
Don't have an account?

Passing a non-edited value from an Aura component back during save
So due to business requirements, I'm using a wrapper to sum daily target data into a single "record" displayed in a lightning:datatable in an aura component. Those summarized records are editable and when saved were divided by seven for the week.
Now the start of the "week" is changeable. In other words some weeks can be seven days long, others can be five depending on the start date. I'm able to get things working fine, creation of new records, extra except for the division part when updating previous records.
Essentially using the "Power of One," I'm summing up the number of days in the "weekly record" and displaying it in the consolidated view for users. I would like to pass that number back to SFDC so the updated values are divided by that summed "Power of One" value.
Hoping some one can help me figure out how to force the component to return the sum even though it hasn't changed, kind of like the ID value. If that value is rreturned, I don't have to do a SOQL query to find the number of daily records for the various "weekly" records.
Thanks.
Now the start of the "week" is changeable. In other words some weeks can be seven days long, others can be five depending on the start date. I'm able to get things working fine, creation of new records, extra except for the division part when updating previous records.
Essentially using the "Power of One," I'm summing up the number of days in the "weekly record" and displaying it in the consolidated view for users. I would like to pass that number back to SFDC so the updated values are divided by that summed "Power of One" value.
Hoping some one can help me figure out how to force the component to return the sum even though it hasn't changed, kind of like the ID value. If that value is rreturned, I don't have to do a SOQL query to find the number of daily records for the various "weekly" records.
Thanks.
As you mentioned, Wrapper is holding all the data that is displayed over the UI. And, need to pass custom logic variable "power of one" to backend which is used to identify the #ofDays in a week.
Thanks,
Gaurav
Skype: gaurav62990
Thanks for the response. So either I'm not following your suggestion or I didnt' make my question clear enough. When the data (AKA "weekly" record) is displayed in the datatable, the end user is able to update the various fields. The component in the browser is only passing the keyFileds (AKA Ids) and the updated field data. Is there a way to possibly pass the PowerofOne value back as well, even though it hasn't been updated? Since there are multiple rows in the datatable there is no way of knowing which row will be updated. If this is possible it seems like would be an attribute you would set on the columns. Similiar to how you can configure a column to be editable but I have not found anything that would allow for this.
Thanks,
Jim
I've been able to add the Power of One variable by looping through the data array and draftValues array matching on the id and adding the variable to the draftValues array prior to handing it off to the callback function.
Cheers,
Jim
Yes, we have to set a Boolean flag in the wrapper as "rowUpdated?" which identifies which row has been modified by the user and can be transferred backend to save the result.
However, for sending back "power of one" every time, use Nested wrapper
Stringify the above wrapper in the JS and send back to the controller as a parameter.
I hope this solves your problem.
Thanks,
Gaurav
Skype: gaurav62990
Since the power of one sum value is available in the data array, can be parsed out of it and added to the draftValues array, especially since multiple records can be updated at the same time, what is the purpose of the nested wrapper?
Thanks,
Jim
@Jim,
If the value is available in Data Array, you can directly send it back to the controller via JS controller.
Thanks,
Gaurav