Skip to content

how to get array of item ids/attrs after making a change? #1998

Answered by cal-zone
cal-zone asked this question in Q&A
Discussion options

You must be logged in to vote

So, by chance, I noticed this line in the store sample code, which I had copied into my code as a stop-gap to get a feel for state being saved:

var order = sortable.toArray();
And then saw that the comment for it say it's trigger onEnd. Ok, that looked promising.

So I copied that line into my own onUpdate:

			onUpdate: function() {
				console.log( sortable.toArray() );
			}

And (again by sheer chance) it just worked on the first pass. I was wondering what it would say and was shocked to see it listed every last database id.

"How is this possible?" I asked? I guessed it must have been pulling from data-id="x" in each element — because actual IDs are not allowed to be numbers. Which is …

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@owen-m1
Comment options

@GregIsJustDucky
Comment options

@lanzer
Comment options

Answer selected by owen-m1
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants