Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline Operation - Document if it requires 'fetch' operation also #489

Open
realtebo opened this issue Aug 4, 2023 · 5 comments
Open

Inline Operation - Document if it requires 'fetch' operation also #489

realtebo opened this issue Aug 4, 2023 · 5 comments
Assignees

Comments

@realtebo
Copy link
Contributor

realtebo commented Aug 4, 2023

Page: https://backpackforlaravel.com/docs/6.x/crud-operation-inline-create

I am setting up field as

    CRUD::field([
            'name' => 'address',
            'inline_create' => true,
        ])
        ->type('relationship')
        ->label('Address')
        ->wrapper(['class' => 'form-group col-md-6'])
    ;

Note: i am omitting ajax

Anyway, this field is automatically a select 2 with ajax.

This need fetch operation, I think. Because opening the select2, an ajax call to a non-existent route ../fetch/... is fired

Please, document it, (or explain me what am I doing wrong).

@karandatwani92
Copy link
Contributor

Yes, you need to use the fetch operation. It's documented here under the relationship field.

Hope this would get you through. Please remember to close the issue.

For more queries, this would be a better place https://github.com/Laravel-Backpack/community-forum/issues
Good day @realtebo

@realtebo
Copy link
Contributor Author

realtebo commented Aug 6, 2023

Thanks, but add a side note into the documentation of inline becase if,as us, are not using the relationship field, you will not face this row of documentation..

I suggest to explain it also here: https://backpackforlaravel.com/docs/6.x/crud-operation-inline-create because it's more related to inline that to relationship

Also, this is not a question about how to do things. We already found the answer, it's a (big) suggestion to improve doc. This is why we decided to open a doc issue and not a Q/A on forum.

Also, as you can see, we are NOT using "ajax" => "true" so it's a bit confusing that it's mandatory to use it and the fetch operation. Just

@tabacitu
Copy link
Member

tabacitu commented Aug 9, 2023

Anyway, this field is automatically a select 2 with ajax.

Hmm I don't think that's intentional. I think that's a bug, to be honest. If you ask me, you should be able to use inline_create with a non-ajax field. I don't see why not.

@pxpm let me do a TLDR for you (everybody correct me if I'm wrong here):

  • @realtebo tried to add a relationship field
  • as soon as he use inline_create relationship turned the field into an AJAX one
  • but that triggered an error, because he didn't have the Fetch operation set up

Are you aware of this restriction @pxpm ? Did we choose to do this? Should we document or fix this?

@pxpm
Copy link
Contributor

pxpm commented Aug 9, 2023

Like you rephrased looks like a restriction, but it's actually the "defaults" we choose at the time and I am still standing by them as I still think they are the most convenient.

The field is indeed by default an ajax field and that's mentioned in the docs:
image

We even mention a Fetch caveat there:
image

It's NOT MANDATORY to use FetchOperation, you can use data_source => 'your.endpoint.

@karandatwani92
Copy link
Contributor

What I get after reading the conversations is, Info is already there but not in the highlights.

@tabacitu do you feel to do something here? It feels like you as the right person to take over this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

4 participants