Field->options(), primary key and alias
Field->options(), primary key and alias
Hello,
Using Field
with a column, which is part of a compound primary key, I need to use an alias, e.g.:
Field::inst( 'a', 'b.c' )
Then, on client side I have to use
fields: [
{
data: 'b.c',
name: 'a'
}
]
( Using just name: 'b.c'
I get an error: "Primary key element is not available in data set." submitting the form)
Adding the Field->options()
, the options in the server response JSON are included as
options: {b.c: [{label: ..., value: ...}, {label: ..., value: ...},…]}
(no dotted object notation, 'b.c' is the attribute name...)
Unfortunately, the client side is awaiting the options according to name
, i.e. as
options: {a: ...}
So, opening the editor form, the select is empty...
Any idea?
Answers
The second argument to
Field::inst()
is both the HTTP parameter name (read on form submission) and the JSON parameter name. The client-side shouldn't see thea
at all in the above case.Can you show me your full Editor initialisation please?
Allan
server side:
client side: