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

  • Home
  • SEARCH
  • 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 6017321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:06:42+00:00 2026-05-23T03:06:42+00:00

I am faced with a problem coding my next feature. I want the user

  • 0

I am faced with a problem coding my next feature. I want the user to be able to rearrange records and change the display_order value. I’m using Jquery UI’s draggable and droppable to facilitate this.

I can see how a simple swap of display_order values would work. But I want to set a display order for a record and ideally have the others shuffle around so there are no repeated display_order values. Apart from not getting my head around how I would do that it seems like it would be hard to code and inefficient, shuffling every value around in the list.

So I am open to other suggestions of how this sort of thing is normally, or should be done.

I though of maybe using a value like 3.000 to represent the order and then when I want to make a record take its place make its value 3 – 0.001 so its 2.999 and will sort between 2 and 3. But I can see so many things wrong with that idea and doesn’t seem like a good path to follow.

Thanks for any input!

  • 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-23T03:06:43+00:00Added an answer on May 23, 2026 at 3:06 am
    • add a sorting column to your table, smallint,
      mediumint or int depending on the
      expected number of total entries
    • A new entry is appended to the end, max(sorting) + 1
    • when reordering an item, get the new position it will be in and alter the higher sorting entries accordingly:

      mysql_query('UPDATE yourTable set sorting = '.$yourNewposition.' where id='.$yourUniqueId .' LIMIT 1');

      mysql_query('UPDATE yourTable set sorting = sorting + 1 where sorting >= '.$yourNewposition.' AND id != '.$yourUniqueId );

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

Sidebar

Related Questions

I have faced this problem quite often during the last couple of months, during
I recently faced a problem of presenting the output of simple genetic algorithm that
We have recently been faced with the problem of porting our C++ framework to
I am currently faced with a difficult sorting problem. I have a collection of
Today we faced a quite simple problem that were made even simpler by the
I face a problem when I try to get value from primary table in
Faced with the challenge of a new application with which you had free reign
I faced a little trouble - I do not know if I can define
I'm faced with writing a framework to simplify working with a large and complex
Here I am faced with an issue that I believe(or at least hope) was

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.