question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BlockUI: widgetVar is reset to null after partial updates

See original GitHub issue

I am using Primefaces 11, and I am adding this components in home.xhtml page:

<p:dataTable id="dataTable" var="n" value="#{homeBean.dataMedel}" lazy="true" paginator="true" rows="10"
             paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {NextPageLink} {RowsPerPageDropdown}" 
             sortOrder="descending" rowsPerPageTemplate="10,15,20,30,50">
<p:blockUI widgetVar="bui" block="dataTable" animate="false">
     <p:graphicImage value="ajax_loader.gif"/>
</p:blockUI>
<h:selectOneMenu id="filterTopic" value="#{filterBean.topic}" label="topic" title="topic"
    <p:ajax event="change" update="dataTable" onstart="PF('bui').show();" oncomplete="PF('bui').hide()"
            listener="#{homeBean.onPreRender}"/>
    <f:selectItems value="#{topicBean.topicList}"/>
</h:selectOneMenu>

when I select one of the items in filterTopic menu, the ajax_loader.gif should fall on the dataTable until the data is fetch from homeBean. but it`s not working and i can see in the console the following error:

Widget for var ‘bui’ not available! --> core.js.xhtml?ln=primefaces&v=11.0.0:18

home.xhtml Uncaught TypeError: Cannot read properties of null (reading ‘hide’) --> home.xhtml

also when refresh page and run PrimeFaces.widgets in browser console, result is:

 bui: c {_super: undefined, cfg: {…}, id: 'form:j_id_bo', jqId: '#form\\:j_id_bo', jq: S.fn.init(1), …}

but when select one of the items in filterTopic menu, bui value set to null:

 bui: null

also this code worked with primefaces 10

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:17 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
mellowarecommented, Mar 9, 2022

I think #5866 is related and was never solved

1reaction
mellowarecommented, Mar 9, 2022

OK i see why its happening its because the BlockUI panel jq object gets created inside the panel. So when the panel is removed from the DOM so it he BlockUI Mask which causes the widget to be marked for removal.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Primefaces BlockUI not working - Stack Overflow
In my JSF form, I am using BlockUI to show the busy status while processing. ... <p:commandButton value="Reset" update="registration:panel" ...
Read more >
BlockUI - PrimeFaces Showcase
The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding. His beloved son Michael...
Read more >
JSF primefaces update dialog not passing value to bean – iTecNote
I can add roles without a problem but when I need to delete or edit its not working due to the roleController.selectedRole being...
Read more >
USER GUIDE 6.1
Defines ajax submit mode, full or partial. DIR ltr. Defines orientation, ltr or rtl. RESET_VALUES false. When enabled, ajax updated inputs are reset....
Read more >
primefaces - issue #2629 - Google Code
Remove script tags of widget after init ... your changes :-) Yes, the idea is good, especially for Ajax updates to prevent "dead"...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found