0

I have "List" attribute in Aura component, <aura:attribute name="chkRecords" type="List" />

Due to some actions, values were added to the chkRecords in component controller. On click of button "Close" calling a controller method where I want to clear chkRecords list. So I am trying to set value to chkRecords using component.set.

closeEditMode : function(component, event, helper){
component.set("v.chkRecords", ""); }

Later when I try to perform an action on same component without refreshing the page, chkRecords contains 1 empty record not sure why list attribute is not cleared? Not sure where I am going wrong.

Thanks in advance.

3
  • Could you please add few more detail as it is not very clear what are you trying to do in your component. Jun 17 at 9:04
  • Set the value to an empty array, component.set("v.chkRecords", []); Jun 17 at 10:00
  • Thanks Rahul Gawale. It worked fine.
    – getty
    Jun 17 at 10:43
0

List is nothing but an array in JS, so you can assign an empty array to the attribute. Like below.

component.set("v.chkRecords", []);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.