You need to sign in to do that
Don't have an account?
LDS input form overwriting previous record
I'm using LDS to create a new record -- it's a simple one field input. After input, the record is saved and the init handler for the component runs again, clearing out my {!v.Message} attribute -- I have verified that this new record is "empty". However, when I enter a new message, it is overwriting the previously saved record instead of creating a new record.
Do I need to do a full reload (instead of a refreshView) of the component to get a fresh new record? If so, the docs are not clear on that process (see code below). Specifically, does this go in the Controller for the component I'm refreshing? If so, then what's the 'c.myController' reference?
Do I need to do a full reload (instead of a refreshView) of the component to get a fresh new record? If so, the docs are not clear on that process (see code below). Specifically, does this go in the Controller for the component I'm refreshing? If so, then what's the 'c.myController' reference?
refresh : function(component, event, helper) { var action = cmp.get('c.myController'); action.setCallback(cmp, function(response) { var state = response.getState(); if (state === 'SUCCESS'){ $A.get('e.force:refreshView').fire(); } else { //do something } } ); $A.enqueueAction(action); }
It's the 3rd param of the getNewRecord() method, commented in the docs as "skip cache?". I had to set it to true so that the subsequent new records would not be pulled from the existing record in the cache. I think that's what's going on -- it works now.