New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when using empty stack container #5

Closed
warmans opened this Issue Oct 13, 2014 · 3 comments

Comments

Projects
None yet
2 participants
@warmans

warmans commented Oct 13, 2014

If you create a container of type stack with an empty content array then try and re-position a different container it will generate an error.

http://codepen.io/anon/pen/lCGvy

TypeError: this._activeContentItem is null

If there is at least one item in the stack it will work fine. I think empty stacks should work because the contents may be based on user selection which would mean they would start empty.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Oct 14, 2014

Contributor

Hi,
Thank you very much for letting me know and preparing a Codepen.

Originally this was by design. If a container is empty, it destroys itself. If the empty container was the only child of its parent the parent will be destroyed as well and so on. So it is virtually impossible for the user to create an empty item.

You do however make a very good point. What if I want to create a layout with some pre-defined sections, but also a specified section that I allow the user to populate dynamically – but which starts empty?

I’ll add support for this in the next release (1.0.4) which should go out in the next few days. – Watch this space for updates.

Cheers,

Wolfram

Contributor

ghost commented Oct 14, 2014

Hi,
Thank you very much for letting me know and preparing a Codepen.

Originally this was by design. If a container is empty, it destroys itself. If the empty container was the only child of its parent the parent will be destroyed as well and so on. So it is virtually impossible for the user to create an empty item.

You do however make a very good point. What if I want to create a layout with some pre-defined sections, but also a specified section that I allow the user to populate dynamically – but which starts empty?

I’ll add support for this in the next release (1.0.4) which should go out in the next few days. – Watch this space for updates.

Cheers,

Wolfram

@warmans

This comment has been minimized.

Show comment
Hide comment
@warmans

warmans Oct 14, 2014

Thank you.

Somewhat related to this It'd be really good if when a container was marked as non-closable it would remain even if all its children are closed. So as not to break BC this could maybe be implemented as a separate container level option e.g. closeOnEmpty=true/false.

This has the same usecase as my original issue. I define an empty tab panel and allow the user to add items to it. If they add an item then remove it the parent is also removed even if set to not allow close.

warmans commented Oct 14, 2014

Thank you.

Somewhat related to this It'd be really good if when a container was marked as non-closable it would remain even if all its children are closed. So as not to break BC this could maybe be implemented as a separate container level option e.g. closeOnEmpty=true/false.

This has the same usecase as my original issue. I define an empty tab panel and allow the user to add items to it. If they add an item then remove it the parent is also removed even if set to not allow close.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Oct 18, 2014

Contributor

v1.0.4 (released 18.10.2014) now properly supports empty stacks. In addition, configuring an item with "isClosable: false" now prevents it from being destroyed if the last of its children is destroyed. It will however still be destroyed if its parent is destroyed.

Please re-open this issue if version 1.0.4 doesn't meet your requirements. Many thanks again for pointing it out.

Contributor

ghost commented Oct 18, 2014

v1.0.4 (released 18.10.2014) now properly supports empty stacks. In addition, configuring an item with "isClosable: false" now prevents it from being destroyed if the last of its children is destroyed. It will however still be destroyed if its parent is destroyed.

Please re-open this issue if version 1.0.4 doesn't meet your requirements. Many thanks again for pointing it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment