Editor One to Many Joins, Select2
Editor One to Many Joins, Select2

Hello Allan,
Is it possible to use select2 on one to many join?
My tables (as link table) are
- act_log_head
- link_log_customer
- master_customer
I want to populate customer name from master_customer
to act_log_head
using select2
My code below is not working with select2, but with checkbox like this example is good
->join(
Mjoin::inst( 'master_customer' )
->link( 'act_log_head.act_log_id', 'link_log_customer.act_log_id' )
->link( 'master_customer.customer_code', 'link_log_customer.customer_code' )
//->order( 'master_customer.name asc' )
->fields(
Field::inst( 'customer_code' )
->options( 'master_customer', 'customer_code', 'customer_name' )
->validator( 'Validate::notEmpty' ),
Field::inst( 'customer_name' )
)
)
{
label: "Customer:",
name: "master_customer[].customer_code",
//type: "checkbox",
type: "select2",
opts: {
multiple: "true"
}
}
Error:
Option 'multiple' is not allowed for Select2 when attached to a <select> element.
Please advise, about the checkbox alternative, because the option are too much. thank you
Danny
This question has accepted answers - jump to:
Answers
Yes, it should be. I've used:
before and it worked okay.
Allan
Hi Allan,
What is the 1,2,3,4,5,6 on options? I think if i'm using select options from MySQL, the
options
can leave blankIs it works with select2 Version: 3.5.4 ?
I still got error
Option 'multiple' is not allowed for Select2 when attached to a <select> element.
Please advise, thank you
Correct - that was just for my test to make sure it was populated correctly. You would use whatever data source you have for your options.
Ah no - probably not. This is with Select2 4.0.1.
Allan
Hi Allan,
I'm changing to Select2 4.0.3 , the select function not working for the
customer
field , it's appear as text. this using Mjoin as on my question (left pic)On my other select2,
status
field, usingLEFT JOIN
, it works. But the options appear behind the modal form. z-index problem maybe? (right pic)Please assist
Hi Allan,
after i added this style, it works as expected
Many thanks,
Danny