Solved

Reorder array information that has id and value data

Posted on 2016-10-13
2
66 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 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CSS (jquiry mobile) question 3 34
CSS Formatting Getting Stripped 1 35
Bootstrap - BootBox - PHP - MYSQL - Response Trigger 6 59
Javascript question 8 43
PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
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)

732 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