1

In my page I have a sortable. At current I have some code like this to return the sort order ";" separated:

JsonChainProcessData.ProcessItemOrder = $(processConstants.chainProcessId).sortable('toArray').join(';');

The toArray function works with the id's of the items in the sortable.

What I need is to have a similar list but now with the value of my custom attr 'pid' instead of 'id'.

My problem is that I have no idea how to loop the items in the sortable and ask them for their attr 'pid'.

for the record I know I can use $(processConstants.chainProcessId).each(etc...) but this of course is not the same as looping the items IN the sortable.

Thanks, Joost

1 Answer 1

2

The toArray method takes an undocumented options argument that can override the attribute used in the returned array (see line 404 in the source code here).

If you don't mind using this undocumented parameter, you can write:

JsonChainProcessData.ProcessItemOrder
    = $(processConstants.chainProcessId).sortable("toArray", {
        attribute: "pid"
    }).join(";");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.