Get the position of item in a sortable group

Support MB Views Get the position of item in a sortable groupResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #41019
    Guillaume LORAINGuillaume LORAIN
    Participant

    Hello.

    I have a group with sortable items.
    In a view, I would like to retrieve the position of my items depending on the sorting I have set. I don't use the default sorting in view so i can't just use {{loop.index}}.

    Do you have an idea of how to proceed ?

    Thanks.

    #41021
    PeterPeter
    Moderator

    Hello,

    The position of the cloneable group is the index of the array and it starts from 0. For example:

    post.group_id[0]

    Or you can use this code to print the group structure

    <pre>
    {{ mb.print_r( post.group_id ) }}
    </pre>
    #41031
    Guillaume LORAINGuillaume LORAIN
    Participant

    Thanks. It help me.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.