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

initialPreview and Tabs #815

Closed
cgi-cgi opened this issue Dec 20, 2016 · 3 comments
Closed

initialPreview and Tabs #815

cgi-cgi opened this issue Dec 20, 2016 · 3 comments

Comments

@cgi-cgi
Copy link

cgi-cgi commented Dec 20, 2016

Hi. Thanks to you for the plugin :)
But I have a problem with latest 4.3.6 version when using it with tabs (for example bootstrap).
For example, fileupload plugin initialized with initial preview files and in element which currently hidden in tab. But jquery with :visible selector seems can't to catch preview elements for attaching some event handlers.

Tab inactive - https://jsfiddle.net/bjdomn08/11/ - not working (click on "delete" file, nothing happens)
Tab active - https://jsfiddle.net/bjdomn08/12/ - working (click on "delete file, request for deletion happens)

If I remove only :visible selector from .file-preview-frame, .kv-file-remove, .file-preview-success, .kv-file-upload classes - it works fine (as it was in previous versions <4.3.6)
(temporarily)
cgi-cgi@9a1cd71
cgi-cgi@c2ac1c4

@kartik-v
Copy link
Owner

Try to initialize the plugin on click / show of the tab - rather than on document ready.

@wat4dog
Copy link

wat4dog commented Dec 26, 2016

First of all: thanks for all your plugins :) @kartik-v

IMHO, it's better to remove :visible from this line. It worked okay in version 4.3.5, and in version 4.3.6 :visible selector added, and of course, if fileinput is not visible on document loading, it won't work.

To re-init plugin, required to setup additional hooks (tab switching, etc), but w/o :visible selector it's not required at all. I'm not lazy, just surprised, when it stopped to work after months. Any real purpose to use visibility check here?

https://github.com/kartik-v/bootstrap-fileinput/blob/master/js/fileinput.js#L1375

@kartik-v
Copy link
Owner

Enhanced to include this ability now to render in tabs.

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

No branches or pull requests

3 participants