0

I wonder why I can't find a component from my backing bean, the code for the bean does:

UIComponent component = viewRoot.findComponent("form_01:meterDialog:lazyGrid");
component.toString();

and the jsf is:

<h:form id="form_01">
    <p:dialog id="meterDialog" header="Meters" widgetVar="meter_data"
    minimizable="true" maximizable="true" draggable="true"
    resizable="true" height="auto" width="auto" onShow="enableForm()">

        <p:remoteCommand id="cmd" name="enableForm" update="lazyGrid">
        <f:setPropertyActionListener value="#{true}"
            target="#{chartBean.formEnable}" />
        </p:remoteCommand>

        <p:panelGrid id="lazyGrid" rendered="true">
        </p:panelGrid>
    </p:dialog>
</h:form>

the problem is that it cant find lazyGrid, it can find the meterDialog with:

viewRoot.findComponent("form_01:meterDialog");

with no problems, but not the components lazyGrid or cmd

Adam B
  • 3,775
  • 3
  • 32
  • 42
Kkloe
  • 189
  • 1
  • 8

2 Answers2

1

If your form is having attribute prependId="false" then you can find with the actual component id.

Since you don't have that attribute set you have to refer from the UIViewRoot. if p:dialog is a naming container(i'm not sure) then you have to refer lazyGrid as "form_01:meterDialog:lazyGrid" else "form_01:lazyGrid".

Here is the link which will give you a more insight
How to find out client ID of component for ajax update/render? Cannot find component with expression "foo" referenced from "bar"

Hope this helps!!!

Community
  • 1
  • 1
Srikanth Ganji
  • 1,127
  • 1
  • 13
  • 29
0

Maybe you should set lazyGrid as the panelGrid id? And close the quotes in UIComponent component = viewRoot.findComponent("form_01:meterDialog:lazyGrid"); !

Zim
  • 1,457
  • 1
  • 10
  • 21