Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Reorder array information that has id and value data

Posted on 2016-10-13
2
Medium Priority
?
79 Views
Last Modified: 2016-10-13
I have a SharePoint list that has a column that allows a user to prioritize or rearrange a list of projects.
Prioritize
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
https://jsfiddle.net/isogunro/btft1Lys/

My goal is to implement the solution with this fiddle.
https://jsfiddle.net/isogunro/sb4ohdkj/

Any help would be much appreciated.
0
Comment
Question by:Isaac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 44

Accepted Solution

by:
zephyr_hex (Megan) earned 2000 total points
ID: 41842864
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
1
 
LVL 5

Author Closing Comment

by:Isaac
ID: 41842970
Thanks!
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question