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

can child element be unsortable ? #1150

Open
Xiangfs opened this issue Aug 2, 2017 · 7 comments
Open

can child element be unsortable ? #1150

Xiangfs opened this issue Aug 2, 2017 · 7 comments

Comments

@Xiangfs
Copy link

Xiangfs commented Aug 2, 2017

image

I want to set the last option button as unsortable, which always stay in the last position.
Can't find param "sortable" in option
this plugin can't support that "li" with special class in ul which can't be sorted by other "li" ?

@smth
Copy link

smth commented Aug 2, 2017

As far as I can see you can't target an item to exclude, but you can specify what items are sortable. So if you can add a class to everything other than that last element, then you can use the draggable option.

draggable: ".item", // Specifies which items inside the element should be draggable

@Xiangfs
Copy link
Author

Xiangfs commented Aug 3, 2017

I've already used the draggable option, and the last element is actually undraggable, but it can be sorted by other element, just as follows:

image

I want to put it as a option button at the end of the row, do you have any suggestions about it ?

@aintJoshinya
Copy link

if you want it to be at the end of the row, why not exclude it from your sortable list altogether? just render it after/outside whatever element you're using as the container for the sortable items.

can you provide a working fiddle/jsbin/codepen for your specific scenario? That could help us provide a solution.

@ethanyuwang
Copy link

I'm trying to achieve the same thing too. Have you found a solution or workaround?

@aintJoshinya
Copy link

@ethanyuwang have you tried rendering it outside the sortable list container?

@skitterm
Copy link

skitterm commented Jun 6, 2019

@Xiangfs you definitely can tell an element to be "unsortable". See the example link on the documentation for onMove. You return false from the onMove event if the element you're "relating with" is the one you don't want to drag.

@miro-ux
Copy link

miro-ux commented Mar 13, 2021

You can achieve this using .exclude class and onMove magic: https://stackoverflow.com/a/66610468/559079

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

6 participants