Left join options

Left join options

modyking55modyking55 Posts: 14Questions: 7Answers: 0
edited February 2018 in General

->options( Options::inst()
->table( 'sites' )
->value( 'id' )
->label( 'name' )
),

can i add join at options that for ex that name col joined with another table for name for mulilanguage

how can i access options response from server_side and client side

Answers

  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin

    Hi,

    Currently there isn't an option to left join from the Options class I'm afraid. You need to use a custom function to get the options, with a query to the database to get the joined data.

    One other option is to create a VIEW in your database for the join query, then the Options class can read that just like it was any other table.

    Allan

  • modyking55modyking55 Posts: 14Questions: 7Answers: 0

    ok but
    how can i access options response from server_side and client side
    to reuse the reponse like at dependency

  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin

    I'm afraid I don't understand. If you create a VIEW for your joined data, the Options class would operate exactly as normal.

    Allan

  • modyking55modyking55 Posts: 14Questions: 7Answers: 0

    for example if i want to get array of data you return it at many functions so i can use it if i want to read the response of option there any way to do it
    like
    options['tablename.col']

  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin

    If you want to inject values (options) into the options property of the JSON that is returned to the client-side, you'd use a custom function for the Field->options() like in the example in the link I gave above.

    Allan

This discussion has been closed.