Closed Gurzhii closed 8 years ago
Also checked source, i got first form here https://monosnap.com/file/IQkoFXqel9sSSlnugBay9VUCJvZEy4.png
I think its because of im trying to render form in non-closed form https://monosnap.com/file/qMigzn5A9EkB2FfPWnCX5sh5NxIbtm.png
I changed in ManagedList.php, line 239
static::FORM_ID => new Part(
new Tag('form', ['data-role' => 'managed_list_form']),
static::FORM_ID,
static::CONTAINER_ID
),
to
static::FORM_ID => new Part(
new Tag('div', ['data-role' => 'managed_list_form']),
static::FORM_ID,
static::CONTAINER_ID
),
and all rendering like i'm expecting - https://monosnap.com/file/gsXmcNswCuPKhAh2zXP3ucOkQ5A8LL.png for what are u using this form?
Upd. I checked up code, and saw that filters using this form, but is it possible to close it earlier than at the end of the table?
Looks like you create form inside another form (grids are placed into forms, but you can change that modifying components tree)
What is your solution for delete button?
Here is the answer: if u need delete button works fine u need to include laravel.js(https://gist.github.com/soufianeEL/3f8483f0f3dc9e3ec5d9) and also did the trick with replacing your form by
<a href="{{ route($route, [$id]) }}" data-method="delete" data-token="{{csrf_token()}}" data-confirm="Are you sure?" class="btn btn-danger">Delete</a>
a) Place form for submitting "delete" request after (or before) grid and add onclick event for pushing deleted record ID into form & submitting it (looks like best way)
b) Detach "form" component from grid & attach to another place, for example inside "control_row" component (becouse there are all inputs that should be placed inside this form). (require no javascript, but you will have alot of sex with grids package)
c) Delete records by GET request, but you will need to make confirmation to avoid auto-visiting links by some browser plugins & provide token for security reasons (looks overcomplicated, but all that security features can be optional depending on your business/quality requirements)
d) Send HTTP request for deleting record via ajax
Nice solution too, thanx for sharing
Also I started to work on documentation, that's drafts, so you will not find links ot it inside readme, but it may be useful:
https://github.com/view-components/view-components/blob/master/doc/cookbook.md
https://github.com/view-components/view-components/blob/master/doc/components.md
Some advices:
Got an issue here.
Here is generateDeleteFormButton
and also delete_column view
On first button i got no rendered form tag https://monosnap.com/file/qTPHn3Z9JCnxo6JJogRLVuFqCBsL5A.png and because of this flow my click expected as GET request https://monosnap.com/file/J5slnZgbyEIacj1mKnLvYIdUgfIL62.png also nothing happed