function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tyler ZikaTyler Zika 

Delete records, Lightning

I'm having a hard time making this documentation

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/apex_records_delete.htm

work for my Lightning app. In the tutorial it says "For example, you have a component that contains a sub-component that is iterated over to display the records. Your sub-component contains a button (1), which when pressed fires an event that’s handled by the container component (2), which deletes the record that’s clicked on." (emphasis added)

Going further... "In the container component, include a handler for the event. In this example, c:expenseList is the sub-component that displays records." (emphasis added)

Example code from docs
<aura:handler name="deleteExpenseItem" event="c:deleteExpenseItem" action="c:deleteEvent"/>
<aura:iteration items="{!v.expenses}" var="expense">
    <c:expenseList expense="{!expense}"/>
</aura:iteration>



My app doesn't have a sub-component that is iterated over. Here is how it's structured.
<aura:iteration items="{!v.items}" var="i">
        <aura:if isTrue="{!i.PersonalItem__c}">
        <aura:if isTrue="{!i.CreatedById == v.currentUserId}">
        <tr>
            <td><ui:inputCheckbox value="{!i.Completed__c}"/></td>
            <td><ui:outputText value="{!i.Name}"/></td>
            <td><ui:outputText value="{!i.AssignedTo__c}"/></td>
            <td><ui:outputText value="{!i.Item_Due_Date__c}"/></td>
            <td><ui:button label="High Priority"/></td>
            <td><ui:button label="Delete" press="{!c.delete}"/></td>
        </tr>
        </aura:if>
        </aura:if>
</aura:iteration>

Do I need to make my interation list a subcomponent in order to delete them on the list, or is there some other way?