pluck() on property derived from leftJoin

pluck() on property derived from leftJoin

ekkerothekkeroth Posts: 19Questions: 6Answers: 0

does anybody know why

        var Lat = table.rows( indexes ).data().pluck( 'Lat' );

works, but

        var Lat = table.rows( indexes ).data().pluck( 'fi_branch.lat' );

does not?
The result is undefinded.

Could it be that pluck() has a problem with joined tables?

The corresponding line from the php files would be:

        Field::inst( 'Lat' ),

and

        Field::inst( 'fi_branch.lat' ),

Replies

  • kthorngrenkthorngren Posts: 21,459Questions: 26Answers: 4,975

    Is your data returned as an array or as objects?

    If an array then you may need to change your pluck to reference the column number, for example:
    var Lat = table.rows( indexes ).data().pluck( 3 );
    Assuming Lat is column 3.

    Kevin

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    It is unlikely you have a property name with a . in it, and pluck only operates on a single level. It will not go down and get nested data like columns.data and fields.name will.

    Allan

  • ekkerothekkeroth Posts: 19Questions: 6Answers: 0

    Thank you.
    Referencing the column number by number did not work either.
    Hence, will look more into columns.data then.

This discussion has been closed.