• Resolved michael81170

    (@michael81170)


    Hello,

    i have pictures and want to sort, i have found:

    “columnDefs”: [ { “visible”: false, “targets”: [ 2 ] }, { “orderData”: [ 2 ], “targets”: [ 3 ] } ]

    The 2 (appearing twice is a reference to the third column (in this example). As counting the columns starts with 0, this would have to be adjusted to “(number of the new column) – 1”. The 3 references the column with the images, and that would have to be adjusted to “(number of the image column) – 1”.

    Sorry, I dont understand.
    My pictures are at A2 A3 and so on.

    – A B C D E
    1
    2 x
    3 x

    that is:

    – 0 1 2 3 4
    0
    1 x
    2 x

    I start at row 1 (normally 2) and at column 0 (normally A).
    So this must be [ 0 ] [ 0 ] and [ 1 ]? wrong? “ok thats wrong, i have tested”

    How does the pictures sort? Can i sort with the image-alt-tag as alt=”1″, alt=”2″ and so on, so must be the code: “columnDefs”: [ { “visible”: false, “alt”: [ 0 ] }, { “orderData”: [ 0 ], “alt”: [ 1 ] } ]

    Thanks for help and best regards,
    Michael

    • This topic was modified 7 years, 3 months ago by michael81170.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    All this will not help with sorting the “alt” tag of images, as that is not directly possible.
    You would have to create a new (second) column in your table and also put the “alt” tag information (only the content, i.e. the numbers) there.
    Then, you can use the “Custom Command”

    "columnDefs": [ { "visible": false, "targets": [ 1 ] }, { "orderData": [ 1 ], "targets": [ 0 ] } ]
    

    This code will then instruct the sorting algorithm to use the data from the (now hidden) column 2 when the user wants to sort column 1 (the column with the images).

    Regards,
    Tobias

    Thread Starter michael81170

    (@michael81170)

    thanks a lot,

    ok i think i have understand this. So i need first to create a column for the sorting information. If my sorting information column is on position A0 A1.. and my images/or something are on B0 B1..
    – A B C D
    0 i
    1 i x
    2 i x

    so the hidden-sort-information is really on position 0 and the pictures “later sort-column” at column 1
    – 0 1 2 3
    0 i
    1 i x
    2 i x

    i=hidden sorting information
    x=pictures/or something else

    so the code must be:
    “columnDefs”: [ { “visible”: false, “targets”: [ 0 ] }, { “orderData”: [ 0 ], “targets”: [ 1 ] } ]

    is it possible to insert a second hidden sort-information like colums 5 hidden information / column 6 sort by hidden information; code:
    “columnDefs”: [ { “visible”: false, “targets”: [ 0 ] }, { “orderData”: [ 0 ], “targets”: [ 1 ] } ] [ { “visible”: false, “targets”: [ 5 ] }, { “orderData”: [ 5 ], “targets”: [ 6 ] } ]

    Does this work?
    thanks a lot and best regards,
    Michael

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    yes, that should work like that ??

    Regards,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sort with pictures “alt-tag”’ is closed to new replies.