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

The elPreviewContainer setting is invalid and the parent element of preview cannot be customized #1837

Open
qooloop opened this issue Mar 20, 2023 · 0 comments

Comments

@qooloop
Copy link

qooloop commented Mar 20, 2023

JS:

$('#photofile').fileinput({
        language: 'zh',
        dropZoneEnabled: false,
        elPreviewContainer: '#filePreview',
        // elPreviewImage: '#fileThumbnails',
        // showClose: false,
        allowedFileExtensions: ['jpg', 'png', 'jpeg'],
        maxFileSize: 20480,   //kb
        uploadUrl: '/web/photoUpload',
        uploadAsync: true,
        uploadClass: 'btn btn-success',
        removeClass: 'btn btn-danger',
        fileActionSettings: {
            removeIcon: '<i class="fas fa-trash-alt"></i>',
            showZoom: false,
            showDrag: false,
            showRotate: false,
            showUpload: false
        }
    }).on("fileuploaded", function (event, data) {
        console.log(data);
        $("#photo").val(data.response.url);
    });

HTML:

<div class="row">
      <div class="col-12">
          <div class="form-group">
              <label class="control-label required">Photo</label>
              <input id="photofile" name="photofile" type="file" class="file">
              <input type="hidden" id="photo">
          </div>
      </div>
      <div class="col-12">
          <div class="form-group">
              <div id="filePreview">

              </div>
          </div>
      </div>
</div>

Question:
elPreviewContainer has set the ID:filePreview in the initialization, but it did not work, when i open the preview, preview container is still under div.file-input

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

No branches or pull requests

1 participant