Closed msassa closed 6 years ago
I already knows what is causing this error. I added this
$(document).pjax('a:not(a[target="_blank"], **a[no-pjax]** )', {
container: '#pjax-container'
});
(the ** is only to mark what I added)
So I can make the add and edit link don't load through ajax.
And that is causing this error, but I don't know why ! If load from ajax, is good, if I add that code and the parameter to the link, and load as a new page, I had an error.
Mmmm I finally found the problem.
I'm including vuejs into the admin, and doing that the tag <template>
used in the hasMany field is removed. So, all the field functionality is missing.
Someone has been able to include vuejs without broke something.
I need help in this, please, because I already have an advanced admin with some days of work, and need vuejs inside the admin.
Thanks.
https://github.com/vuejs/vue/issues/2051
Try to add v-pre
to the template tag in vendor/encore/laravel-admin/resources/views/form/hasmany.blade.php
and see if it works?
Thank you, but is not working. I try adding a v-pre to the template tag, and not work. I try wrapping the template in a div and adding the v-pre to that div, neither.
I fix the problem making 2 changes:
Using the directive v-html to render the template, so in hasmany.blade.php
<div v-html="`
<template class="{{$column}}-tpl">
<div class="has-many-{{$column}}-form fields-group test">
{!! $template !!}
<div class="form-group">
<label class="{{$viewClass['label']}} control-label"></label>
<div class="{{$viewClass['field']}}">
<div class="remove btn btn-warning btn-sm pull-right"><i class="fa fa-trash"></i> {{ trans('admin.remove') }}</div>
</div>
</div>
<hr>
</div>
</template>
`">
</div>
and in the HasMany.php
'template' => str_replace('"', '"', $template),
And is working. I confirm with the team of vuejs that v-pre do not works on template tags. But should be.
thank you! It 's work!
Description:
Into the 'dealers' form add/edit, when I add a hasMany field for an addresses relation, or whatever relation, always shows one more empty item. If there are no address related, shows one empty line, if there are some item related, shows one extra empty item:
And for any model ... here is other example with news and images:
And I can remove the item but not add a new one, I get this error:
Models:
Steps To Reproduce: asd