Closed johnguild closed 7 years ago
@johnguild Is there any errors in console?
Says filemanager is not a function
jQuery.Deferred exception: $(...).filemanager is not a function TypeError: $(...).filemanager is not a function
at HTMLDocument.<anonymous> (http://myproject.dev/js/custom.js:69:12)
at j `(http://myproject.dev/js/jquery-3.1.1.min.js:2:29948)`
at k (http://myproject.dev/js/jquery-3.1.1.min.js:2:30262) undefined
r.Deferred.exceptionHook @ jquery-3.1.1.min.js:2
k @ jquery-3.1.1.min.js:2
jquery-3.1.1.min.js:2 Uncaught TypeError: $(...).filemanager is not a function
at HTMLDocument.<anonymous> (custom.js:69)
at j (jquery-3.1.1.min.js:2)
at k (jquery-3.1.1.min.js:2)
As i mention above it will work once i import the js and call the function inside my childview, i could work with that way, however it would be great if it can be called and use inside the layout page.
Are you using Blade or Jade or Pug for your template engine? Please paste the code of your view here.
I found the issue.
In the layout view the
<script src="/vendor/laravel-filemanager/js/lfm.js"></script>
should be called after the default app.js of laravel
<script src="/js/app.js"></script>
For some reason with this order
<script src="/vendor/laravel-filemanager/js/lfm.js"></script>
<script src="/js/app.js"></script>
will throw an error
app.js:3 jQuery.Deferred exception: $(...).filemanager is not a function TypeError: $(...).filemanager is not a function
at HTMLDocument.<anonymous> (http://site.dev/testing:48:17)
at c (http://site.dev/js/app.js:3:14745)
at l (http://site.dev/js/app.js:3:15060) undefined
gt.Deferred.exceptionHook @ app.js:3
l @ app.js:3
app.js:3 Uncaught TypeError: $(...).filemanager is not a function
at HTMLDocument.<anonymous> (testing:48)
at c (app.js:3)
at l (app.js:3)
Understood.
I guess jQuery is contained in app.js
.
Glad you found it out.
Please help...
In my laravel porject
I include
<script src="/vendor/laravel-filemanager/js/lfm.js"></script>
on my layout viewand called
$('#lfm').filemanager('image');
after inside a$(document).ready(function(){});
Im sure that -jquery was loaded before -the view (childview) that contains the html extends the layout
the plugin will work only if i import the lfm.js inside the childview and call the function after.