camohub / jquery-sortable-lists

jQuery plugin to sorting lists also the tree structures.
MIT License
209 stars 60 forks source link

Max Levels #55

Open IanRobbRB opened 4 years ago

IanRobbRB commented 4 years ago

Is there a way to set the maximum number of levels?

camohub commented 4 years ago

You can use isAllowed callback to cout levels and deny insertion.

IanRobbRB commented 4 years ago

How would that work? Would that not stop all dragging and dropping completely? So if I just wanted the top level and then the one level underneath?

camohub commented 4 years ago

I am on the phone. But the first example in documentation contains c block which uses isAllowed calback to deny insertion. Open source code and you will see that.

camohub commented 4 years ago

Also you can style hint element by css e.g. with display none.

camohub commented 4 years ago

I am working on maxLevel feature. You can wait for it if you want. It was little complicated to handle levels via isAllowed callback. So I decided to add this feature. Hope I'll do it today.

IanRobbRB commented 4 years ago

That sounds great, I will do that. Other than that the plugin is great!

camohub commented 4 years ago

Almost there ...

camohub commented 4 years ago

I made it to dev branch https://github.com/camohub/jquery-sortable-lists/tree/dev But there is a problem with drop speed after few drag operation it starts to be very slow. Is 0:45 here I am going to sleep. Hope I will solve it morning. You can test it but only non-mobile version.

IanRobbRB commented 4 years ago

I had a look last night and it is looking really good. The max levels works perfectly!

camohub commented 4 years ago

There was a bug. Now it is fixed in dev branch. Also I changed names for classes and ids. Everything started with sortableListsXXX... now begins with s-l-XXX.

camohub commented 4 years ago

I made a release of 2.0.0 for NPM and BOWER. Try it if you can.