Closed robbykrlos closed 5 years ago
label - string, optional, default name - the attribute that is to be used as label from the result/options list
the front end component needs this attribute. If you're using enso-form
/ vue-form
you should add "label": "permission_group_name"
to the field's meta
object
label - string, optional, default name - the attribute that is to be used as label from the result/options list
the front end component needs this attribute. If you're using
enso-form
/vue-form
you should add"label": "permission_group_name"
to the field'smeta
object
Nice! Thank you. I'm still getting familiar with enso, had thought that the select documentation should have contained this detail, although makes perfect sense to be a front-end thing... duuh..
Now I know! Have a good weekend.
The link is from the select documentation, but the FE part :)
The link is from the select documentation, but the FE part :)
<synapses firing>
This is a bug.
Prerequisites
Description
Problem: Select options are missing names(labels). I'm trying to create a simple form where 1-n relations are set. I have a "Group" model, where a FK "permission_group_id" can be set. For this I tried using a select field with the options from the "PermissionGroup" controller
/app/Http/Controllers/Models/Permissiongroups/Options.php ` class Options extends Controller { use OptionsBuilder;
}
/app/Forms/Templates/Models/group.json
{ "routePrefix": "models.groups", "sections": [ { "columns": 2, "fields": [ { "label": "Permission Group Id", "name": "permission_group_id", "value": null, "meta": { "type": "select", "multiple": false, "options": [], "source": "models.permissiongroups.options" } }, { "label": "Group Name", "name": "group_name", "value": null, "meta": { "custom": false, "type": "input", "content": "text", "disabled": false } } ] } ] } `/app/Tables/Builders/Models/GroupTable.php ` class GroupTable extends Table { protected $templatePath = DIR.'/../../Templates/Models/groups.json';
} `
I think the problem is the deviation from the default "name" queryAttribute which is expected, and in my situation the "name" which should be used as select option label is called "permission_group_name"
Ajax call is returning a valid JSON ;
Steps to Reproduce
Create a Select field which uses the options of a different model which has no "name" column.
Expected behavior
To see the options generated in the options
Actual behavior
Options are generated but without a name