Jump to content

Arrays


Xtremer360

Recommended Posts

I am really hoping someone is willing to take the time to read this post and take a minute to take a look at my code. What is happening is there are some matches for a script I made and then an area for segments during an event. If you notice on the segment part of the form is that there is a dropdown that asks for where in the event that segment needs to go.  With the Introduction or the different numbered matches.  What I need to happen for a subArray I need it to take the introduction, all the matches, and all the segments and order them accordingly. With the introduction first, the matches in order based off there match number and then the segments in between the introduction or matches based off the user's input.

Link to comment
Share on other sites

I can't find any syntax for how to sort something with JQuery but here's a description of what I'm wanting to do.

 

 

1. Start with the list of matches, in order. Introduction comes first.

2. Sort the segments by segmentOrder first, segmentNum second.

3. Insert each segment after match #(segmentOrder), in the same order.

 

 

 

Introduction: type=M, m=I,            n=0
Matches:      type=M, m=match number, n=0
Segments:     type=S, m=segmentOrder, n=segmentNum

Sort:
1. m (ascending; I first)
2. type (M first, S second)
3. n (ascending)


Before                 After
--------------------   --------------------
I:  type=M, m=I, n=0   I:  type=M, m=I, n=0
M1: type=M, m=1, n=0   S1: type=S, m=I, n=1
M2: type=M, m=2, n=0   M1: type=M, m=1, n=0
M3: type=M, m=3, n=0   S2: type=S, m=1, n=2
M4: type=M, m=4, n=0   S3: type=S, m=1, n=3
M5: type=M, m=5, n=0   M2: type=M, m=2, n=0
M6: type=M, m=6, n=0   M3: type=M, m=3, n=0
M7: type=M, m=7, n=0   S4: type=S, m=3, n=4
S1: type=S, m=I, n=1   M4: type=M, m=4, n=0
S2: type=S, m=1, n=2   M5: type=M, m=5, n=0
S3: type=S, m=1, n=3   M6: type=M, m=6, n=0
S4: type=S, m=3, n=4   S5: type=S, m=6, n=5
S5: type=S, m=6, n=5   M7: type=M, m=7, n=0

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.