Skip to content
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

Add a new nested list item #47

Closed
ghost opened this issue Oct 11, 2018 · 6 comments
Closed

Add a new nested list item #47

ghost opened this issue Oct 11, 2018 · 6 comments

Comments

@ghost
Copy link

ghost commented Oct 11, 2018

Hey there! Thanks for this awesome library. I am using it to implement a system where upon clicking on a button, a new list item is added to the main ul. Now, the item does get appended but it doesn't receive the icons for the openers that i set in the options. I can see the list item and it's always opened without the '+' or '-' signs so i can't open or close that particular list item. Can you let me know how that would be done as the only way i found is to re-create the Sortable List using $('element').sortableLists({ options }) but that appends the '+' and '-' icons to each and every list item multiple times

@camohub
Copy link
Owner

camohub commented Oct 16, 2018

Hi, if you need to create new items you has to create the same html structure as the plugin creates manually. Also with opener if item contains nested items.

@ghost
Copy link
Author

ghost commented Oct 17, 2018

Yes thats working fine. The problem is that the ul elements inside of li are generated dynamically whenever an item is dragged and dropped inside of an li. I want the ul to always be there so that the moment i want something inside of a list, i can just append it. The problem is that even if i do that, it gets replaced with the ul that's generated dynamically

@camohub
Copy link
Owner

camohub commented Oct 17, 2018

I am little confused. Nested ul element can not exists if it is empty. It is semantic nonsense. If it is not empty it should work and should not be replaced.

@ghost
Copy link
Author

ghost commented Oct 17, 2018

I am implementing a Layer system where each layer can contain multiple shapes inside it. Initially, all layers are empty. What i want to do is that as soon as the user draws a shape on the canvas, the shape should get appended to the layer automatically without someone dragging and dropping anything inside it. The problem is that i cannot do that since there is no ul inside the li's by default. If i try to create a ul myself, it gets replaced with the ul that is generated when item are dropped into an li.

@camohub
Copy link
Owner

camohub commented Oct 17, 2018

If u create ul>li whih the shape it is deleted and replaced with new one? I dont think so. Plugin removes empty uls inside the list at some points. Cause empty uls have no sense in my opinion. But if the ul is not empty(contains at least one li) it should not be deleted.

@ghost
Copy link
Author

ghost commented Oct 17, 2018

That's where the problem is :( It really doesn't make any sense to have empty uls but in my case, it makes sense as layers can be empty. Well, i guess i'm gonna have to change your code a bit as there's no other way.

@camohub camohub closed this as completed Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant