0

I have a list of items as an attribute that contains 5 items. Through aura:iteration, I'm printing only the first 3 on the UI. From the front end, I'm able to remove items from this list as well. I'm a bit confused as to why my list isn't displaying the next item considering they're are 5 items and removing one results in 4 items so I want it to display the first 3 again, yet it displays only the remaining 2.

Is this due to aura:iteration not being reset since I am using the end attribute? How can I achieve this? The number of items are being updated properly as I am printing the list each time an item is removed too.

<aura:iteration items="{!v.items}" start="0" end="3" var="task">
   {!item.Name}
</aura:iteration>



removeItem : function(component, taskIndex) {
  var items = component.get("v.items");
  items.splice(taskIndex,1);
  component.set("v.items", items);
}

Here, the items list has 4 items. If I remove an item then the remaining two are only visible and the list items don't move up -- yet when I print it out the list has been updated with 3 items and should be displaying all 3 instead of only two.

  • can u add your code snippet, so that it's easy to give solution – sdandamud1 Oct 14 '19 at 19:53

Your Answer

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

Browse other questions tagged or ask your own question.