When I click on the new button it should open a dialog box but it does not open and gives this error in the console:
widget for var 'test' not available
What can it be?
<ui:define name="menu">
<ui:include src="/includes/menuPrincipal.xhtml"></ui:include>
</ui:define>
<ui:define name="conteudo">
<h:form>
<p:dataTable emptyMessage="Nenhum registro encontrado"
value="#{MBFrabicante.itens}" var="item" paginator="true" rows="10">
<f:facet name="header">
Fabricante - listagem
</f:facet>
<p:column headerText="Código" sortBy="#{item.codigo}"
filterBy="#{item.codigo}">
<h:outputText value="#{item.codigo}" />
</p:column>
<p:column headerText="Descrição">
<h:outputText value="#{item.descricao}"></h:outputText>
</p:column>
<f:facet name="footer">
<p:commandButton value="Novo" onclick="PF('teste').show();" />
</f:facet>
</p:dataTable>
</h:form>
</ui:define>
<p:dialog widgetVar="teste" resizable="false" header="Fabricante - Novo"
modal="true" appendTo="@(body)">
<h:form>
<h:panelGrid columns="2">
<p:outputLabel value="Descrição: "></p:outputLabel>
<p:inputText size="30" maxlength="50" />
</h:panelGrid>
<h:panelGrid columns="2">
<p:commandButton value="Gravar" />
<p:commandButton value="Cancelar" onclick="PF('dlgFabNovo').hide();" />
</h:panelGrid>
</h:form>
</p:dialog>