2

The component does not work correctly when on the same page using the component

The error occurs after loading the first file javascript error occurs and then can not continue using the file upload component

The blockUI element is like this:

<pe:blockUI widgetVar="uploadPrBroBloc" block="importPanel"
                        trigger=":pim:uploadProBroFile">
                        <em class="fa fa-spinner fa-spin"></em> #{msgs.UPLOADING}
                    </pe:blockUI>

The fileUpload UI is :

<p:fileUpload id="uploadProBroFile" auto="true"
              styleClass="uploadImage"
              fileUploadListener="#{importPackageController.handleProductBrowserFileUpload}"
              label="#{msgs.BTN_UPLOAD_FILE}" allowTypes="/(\.|\/)(XLSX|xlsx)$/"
              update="proBro_file_name" />

i have done some search, the problem is that the use of the "trigger" attribute on the element - seems to have a conflict with it

Does any one have an idea, thanks in advance !

Melloware
  • 10,435
  • 2
  • 32
  • 62
Shessuky
  • 1,846
  • 21
  • 24
  • p:blockUI != pe:blockUI, you use one in the title, the other in the question. And one is from PrimeFaces and the other is from PrimeFaces, both are not tags in your question. – Kukeltje Jul 19 '18 at 13:59
  • p: is for http://primefaces.org/ui whereas pe: is for http://primefaces.org/ui/extensions, both of them do not work in this case – Shessuky Jul 23 '18 at 09:16
  • Yes I know but you had an inconsistency in the title/text and someone already fixed that for you. – Kukeltje Jul 23 '18 at 10:12
  • @Kukeltje Now i get what you want to say !...thanks ! – Shessuky Jul 23 '18 at 15:31

1 Answers1

2

I have found an idea, enable and disable the block in the p:fileUpload UI events instead of setting a trigger in the blockUI for it:

The p:fileUpload will look like:

<p:fileUpload id="uploadProBroFile" auto="true"
              onstart="PF('uploadPrBroBloc').block()" 
              oncomplete="PF('uploadPrBroBloc').unblock()"
              styleClass="uploadImage"
              fileUploadListener="#{importPackageController.handleProductBrowserFileUpload}"
              label="#{msgs.BTN_UPLOAD_FILE}" allowTypes="/(\.|\/)(XLSX|xlsx)$/"
              update="proBro_file_name" />

The blockUI element will not use a trigger :

            <pe:blockUI widgetVar="uploadPrBroBloc" block="importPanel">
                <em class="fa fa-spinner fa-spin"></em> #{msgs.UPLOADING}
            </pe:blockUI>

Hope this help anyone having the same problem !

Shessuky
  • 1,846
  • 21
  • 24