Skip to content
Discussion options

You must be logged in to vote

Sorry @emogeekface I may have missed your question.

That option to provide a different key is not applied to select2_from_ajax field, it's locked to get the actual "model" key:

<option value="{{ $item->getKey() }}" selected>
                {{ $item->{$field['attribute']} }}
            </option>

So the only way to use other key is if that $item is effectively using other key defined in the model.

An easy way out is to publish the select2_from_ajax.blade.php with php artisan backpack:field select2_from_ajax_custom_key --from=select2_from_ajax (you need backpack generators installed to run this command, or you can do it manually.)

It will publish a copy of the ajax field to your resource…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@emogeekface
Comment options

@pxpm
Comment options

pxpm Mar 31, 2023
Maintainer

Answer selected by jcastroa87
@emogeekface
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants