I'm displaying a list of items in a StackedView within a ScrollView. Each item has a delete button that the user can use to remove that item from the list. It behaves as expected if the user deletes either the first or the last item in the list. However, if they delete an item from the middle of the list, all items below the deleted item are also removed from the view. The items above the deleted item remain in the DOM, but they are hidden from view because the height of the StackedView gets set to zero.
I've tried using a ListView instead of StackedView, but the only difference is that the height is not reset to zero after an item is deleted. The items after the deleted item are still removed from the view.
Any help on this would be appreciated.
Here's the relevant chunk of code from my view:
collection: SC.ScrollView.design({
contentView: SC.StackedView.design({
contentBinding: 'MyListContentController.arrangedObjects',
exampleView: SC.View.design(SC.StaticLayout, {
useStaticLayout: YES,
childViews: 'data deleteButton'.w(),
data: SC.TextFieldView.design({
//........
}),
deleteButton: SC.ButtonView.extend({
//........
action: 'removeEntry'
}),
removeEntry: function () {
MyListContentController.removeObject(this.get('content'));
//calls SC.ArrayController.removeObject()
}
})
})
})