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
MaxLevels not working #64
Comments
I test it right now. It works as expected. What is wrong? |
I am creating a dynamic menu. The user can drag and nest the menu items as they wish, but I want to allow only 2 levels of nesting. However, when I add the option {maxLevels : 2}, the nesting capabilities during the drag and drop are gone. It only allows me to change the order. I don't have any other options that might be conflicting. Nesting works when MaxLevels is off. Nesting does not work when MaxLevels has a value. Just wondering if you can think of a reason this would happen? |
It seems the problem is in your code. I test it and it works. Can you create an online example or Github repository? |
Hi, so I did a couple of tests and I figured out that the plugin works well when you have static HTML laid out to begin with. But when you add content dynamically, like I'm trying to do, it fails. I made a simplified version of what I'm trying to do here so you can see for yourself: https://github.com/lulubytt/jquery-sortable-lists-test thanks! |
You generate incorrect html structure. it has to be li>div not li>a |
Thanks for taking a look. You're right, I tried first with the correct html structure: li>div but that didn't work either, so I removed the div to see what would happen. Neither work. I just changed it back to the correct structure and you can see in my repo that it still doesn't work. :/ |
Another problem is the maxLevels needs to add data-upperLevels and data-insideLevels attribute to the li element if you generate it. |
Yes it seems it is a bug. It needs to be fixed. I am sorry. |
No worries! I will be more than happy to make a donation to your account if you think you can get this fixed within the next week or so? Thanks! |
Ok I can. |
Hi, I fixed it. Try the newest version 2.4 and use minified version please. Added item has to have Let me know how it turned out. |
Worked like a charm! Thanks so much :) |
Hello @camohub! Thanks for a great plugin, this has saved me hours of dev work. :)
One issue though: the maxLevels options is not working. When I set it to a number, it stops nesting altogether. If I remove the maxLevels option (it defaults to false), it starts nesting again.
Please advise. Thanks!
The text was updated successfully, but these errors were encountered: