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
Solved

Reorder array information that has id and value data

Posted on 2016-10-13
2
58 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
2 Comments
 
LVL 43

Accepted Solution

by:
zephyr_hex (Megan) earned 500 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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)
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

856 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