+ Start a Discussion
Mee SharmaMee Sharma 

aura:method -'not a function' error

My requirement is that when i check the checkboxes and click on delete button the records need to be deleted.
I am getting the following error while trying to click on delete button(created in parent cmp) which accesses the delete method in its child component.
Please help as I am not able to find out what is wrong..

"This page has an error. You might just need to refresh it. Action failed: c:Budgetdisplay$controller$delparent [chn.deletemethod is not a function] Failing descriptor: {c:Budgetdisplay$controller$delparent}"

Parent component
<!--data table-columns--->
 <lightning:button label="Delete"                         
    <!-- ITERATION -->
                      <aura:iteration items="{!v.expense}" var="e" indexVar="sNo">
                       <!-- Child Lightning Component --> 
                    <c:inlineedit aura:id ="inline" singleRec="{!e}"
                                     sNo="{!sNo + 1}" />

parent controller

delparent : function(component,event,helper){
      var chn = component.find("inline");

child component
 <!--Table Row Start-->  
        <aura:method name="deletemethod" action = "{!c.delete}" access="global"/>       
       <tr class="slds-hint-parent" >
           <ui:inputCheckbox aura:id="eachbox" text="{!v.singleRec.Id}" />
    <!---other rows--->

child controller
delete :function(component, event, helper){
    var delid = [];
    var getAllId = component.find("eachbox");
    if(! Array.isArray(getAllId)){
         if (getAllId.get("v.value") == true) {
      for (var i = 0; i < getAllId.length; i++) {
       if (getAllId[i].get("v.value") == true) {
    helper.deleteSelectedHelper(component, event, delid);
Hi Meenakshi,
 here is the sample post same as your requirement :

Thanks, let us know if it helps you
Mee SharmaMee Sharma
Apologies if my requirement is unclear. I have placed the delete button in the parent component and not in the child component,hence i am using aura:method.But its not working and i am getting the error mentioned iny post
you are create <aura:method name="deletemethod" action = "{!c.delete}" access="global"/> on child component and call it from parent component, can you share all codes (Lightning component + apex + js) here OR my email id sfdcmonkey@gmail.com so i can help you to solve this issue