Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5941763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:09:21+00:00 2026-05-22T16:09:21+00:00

Is it possible to lock list items in JQuery sortable list in a way

  • 0

Is it possible to lock list items in JQuery sortable list in a way that those items will stay in that particular place in the list.

For example,

consider this pseudo list with locked items…

item A
item B(locked)
item C(locked)
item D
item E
item F
item G(locked)

So, I’d like to have the items B,C and G to be fixed in a way that if user drag and drop item D at the start of the list, the item A “jumps” over fixed/locked items B and C with following results…

item D
item B(locked)
item C(locked)
item A
item E
item F
item G(locked)

I’ve been searching for something like this without luck. Is it possible..?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:09:22+00:00Added an answer on May 22, 2026 at 4:09 pm

    I extended the jQuery.Ui.sortable:

    Overview

    jQuery.Ui.sortable widget extension with fixed feature. This feature allows user to fix elements in the list.
    With the .fixedsortable() constructor you construct a .sortable() class which extended with the features. You can use the original methods and the extended as well.

    Code

    https://gist.github.com/3758329#file_fixedsortable.js > fixedsortable.js

    Example

    http://jsfiddle.net/omnosis/jQkdb/

    Usage

    General:

    To use, add the fixed property to the sortable list optios:

    $("#list").fixedsortable({
       fixed: (value)
    })
    

    the value can be:

    • integer example: 3
    • array of integers example : [1,2,5]
    • a html element or a list of html elements
    • a css selector
    • jquery object

    HTML:

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> //the jquery 
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script> //the original jquery-ui   
    <script type="text/javascript" src="https://raw.github.com/gist/3758329/91749ff63cbc5056264389588a8ab64238484d74/fixedsortable.js"></script> //the extended sortable
    ...
    <ul id="sortable1">
        <li>oranges</li>
        <li class="static">apples</li>
        <li>bananas</li>
        <li>pineapples</li>
        <li>grapes</li>
        <li class="static">pears</li>
        <li>mango</li>
    </ul>
    
    <ul id="sortable2">
        <li>bananas</li>
        <li foo="asd">oranges</li>
        <li foo="dsa">apples</li>
        <li>pineapples</li>
        <li>grapes</li>
        <li>pears</li>
        <li>mango</li>
    </ul>
    
    <ul id="sortable3">
        <li>bananas</li>
        <li>oranges</li>
        <li>apples</li>
        <li>pineapples</li>
        <li>grapes</li>
        <li>pears</li>
        <li>mango</li>
    </ul>
    

    Javascript

    $(function() {
        $("#sortable1").fixedsortable({
            fixed: "> .static"
        });
    
        $("#sortable2").fixedsortable({
            fixed: $("li[foo]").css("background","red")
        });
    
        $("#sortable3").fixedsortable({
            fixed: 2
        })
    });
    

    Notes:

    If you insist to use the .sortable instead of .fixedsortable you can use this https://gist.github.com/3758329#file_sortable.js instead of the jquery.ui library. This is a complete replacement of the jQuery.ui, but i don’t recommend to use this because of later updates.

    i have been working on this more than 12 hours 🙁 i am insane..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a class that contains (among many other things) a list of items
Is it possible to lock the width of a textbox so that the users
Is it possible to lock the aspect ratio of a JFrame in Java Swing?
Possible Duplicates: Why is lock(this) {...} bad? In C# it is common to use
I need to know is it possible to reserve or lock money with First
Possible Duplicate: .NET - What’s the best way to implement a catch all exceptions
I've got a class in my project that stores a List<> of elements. I'm
For MySQL 5.1, is there a way to get a list of named MySQL
Possible Duplicate: How can I lock a file using java (if possible) I have
I have been searching concurrent linked list implementations/academic papers that allow for concurrent insertions

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.