kartik-v / yii2-widget-fileinput

An enhanced FileInput widget for Bootstrap 4.x/3.x with file preview, multiple selection, and more features (sub repo split from yii2-widgets)
Other
230 stars 96 forks source link

Are themes also available in yii2-widget-fileinput #182

Closed strtob closed 2 years ago

strtob commented 2 years ago

Hi,

Are themes also available in yii2 file input?

I've tried with

 'pluginOptions' => [
                    'theme' => 'explorer',

without success and couldn't find something in the docu or web.

Thanks a lot!

Toby

kartik-v commented 2 years ago

Yes - it should work with that. What is the issue you are facing?

strtob commented 2 years ago

Hi Kartik,

Thanks for your help!

This is my code:

[<?=
            \kartik\widgets\FileInput::widget([
                'name' => 'files[]',
                'id' => 'upload',
                'options' => [
                    'multiple' => true,
                ],
                'pluginOptions' => [
                    'theme' => 'explorer',
                    'initialPreview' => false,
                    'initialPreviewConfig' => false,
                    'showUploadedThumbs' => false,
                    'overwriteInitial' => true,
                    'initialPreviewAsData' => true,
                    'deleteUrl' => false,
                    'previewFileType' => ['any',
                        'showUpload' => true,
                        'showRemove' => false,
                    ],
                    'uploadUrl' => \yii\helpers\Url::to(['file/upload']),
                    'msgUploadBegin' => Yii::t('app', 'Please wait, system is uploading the files'),
                    'msgUploadThreshold' => Yii::t('app', 'Please wait, system is uploading the files'),
                    'msgUploadEnd' => Yii::t('app', 'Done'),
                    'dropZoneClickTitle' => '',
                    'uploadAsync' => true,
                    'browseOnZoneClick' => true,
                    'fileActionSettings' => [
                        'showZoom' => true,
                        'showRemove' => false,
                        'showUpload' => true,
                    ],
                    'maxFileCount' => 20, 'maxFileSize' => 999999999, 'msgPlaceholder' => Yii::t('app', 'Select attachments'),
                    'uploadExtraData' => [
                    // config for relation
                    //                            'relatedTable' => 'FileHasBankAccount',
                    //                            'relationName' => 'fileHasBankAccounts',
                    //                            'relatedTableField' => 'tbl_bank_account_id',
                    //                            'relatedId' => $model->id,                             
                    ],
                //
                ],
                'pluginEvents' => [
                    'filebatchselected' => 'function() {
                                    $(this).fileinput("upload");
                                 }',
                    'fileuploaded' => 'function(event, previewId, index, fileId) {
                                    $.pjax.reload({container: "#kv-pjax-container", async: "false", timeout: "3000"});
                                 }',
                ],
            ]);
            ?> ](![sc](https://user-images.githubusercontent.com/9219549/151127126-9b96b357-a0cb-4a73-b9d8-5ba2fba4dc07.png))
strtob commented 2 years ago

sc

kartik-v commented 2 years ago

Yes... looks ok... can you select files to see if the theme is working fine as per explorer format.

strtob commented 2 years ago

your plugin work's fine! ...after the upload, the files disappear - the process was so fast that it was not possible to see the explorer view