• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 82
  • Last Modified:

Reorder array information that has id and value data

I have a SharePoint list that has a column that allows a user to prioritize or rearrange a list of projects.
I created a piece of it in jsfiddle using arrays.  I'm able to update the values but unable to shift the numbers and order

My goal is to implement the solution with this fiddle.

Any help would be much appreciated.
1 Solution
zephyr_hex (Megan)DeveloperCommented:
Since you are modifying the original array when you do the value replacement, why not just use a sort on that array to get the items reordered?

ary.sort(function(a,b) {
    return a[1] - b[1];

Open in new window

Here is an updated version of your Fiddle
IsaacSharePoint Client Side DeveloperAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now