Retornar a linha de uma datatable

Java

20/12/2010

Boa tarde, Gostaria de saber como eu faço para pegar uma linha de uma tabela, segue o código abaixo? OBS: a linha que eu estou tentando pegar a linha é essa.
<rich:column>
      <Center>
          <h:selectBooleanCheckbox id="chec" value="#{ntf.flgInvestigador}">
             <f:setPropertyActionListener value="ntf" target="#{associarInvestigadorForm.objNotificador}"/>
          <rich:componentControl for="panel2" attachTo="chec" operation="show" event="onclick" />
          </h:selectBooleanCheckbox>
      </Center>
 </rich:column>   segue a página   <?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
 xmlns:ui="http://java.sun.com/jsf/facelets"
 xmlns:f="http://java.sun.com/jsf/core"
 xmlns:h="http://java.sun.com/jsf/html"
 xmlns:a4j="http://richfaces.org/a4j"
 xmlns:rich="http://richfaces.org/rich"> <head>
</head>
<body>
<f:view>
 <h:form id="AssociarInvestigacao">
  <a4j:keepAlive beanName="notificadorForm"></a4j:keepAlive>
  <a4j:keepAlive beanName="associarInvestigadorForm"></a4j:keepAlive>   <!-- MODAL PANEL DE CONFIRMAÇÃO DE EXCLUSAO -->
  <rich:modalPanel id="panel2" height="100" width="350"
   resizeable="false" moveable="false"
   style="background-image: url('IMG/fundomensagem.png');background-position: center;background-repeat: no-repeat;">
   <f:facet name="header">
    <h:panelGroup>
     <h:outputText value="Deseja altera o notificador"></h:outputText>
    </h:panelGroup>
   </f:facet>
   <f:facet name="controls">
    <h:panelGroup>
     <h:graphicImage value="IMG/excluir.png" styleClass="hidelink"
      id="hidelink3" />
     <rich:componentControl for="panel2" attachTo="hidelink3"
      operation="hide" event="onclick" />
    </h:panelGroup>
   </f:facet>
   <center><h:outputText
    style="font-size: small;font-family: arial;"
    value="Deseja alterar notificador?" /><br />
   <rich:spacer height="30" /> <a4j:commandButton id="sim" value="Sim"
    action="#{associarInvestigadorForm.botaoConfirma}"
    reRender="tabelaItens" onclick="Richfaces.hideModalPanel('panel2');" />
   <rich:spacer width="50" /> <a4j:commandButton value="Não"
    onclick="Richfaces.hideModalPanel('panel2');" ajaxSingle="true"
    reRender="dtNotificacao" /></center>
  </rich:modalPanel>
  <!-- FINAL MODAL PANEL DE CONFIRMAÇÃO DE EXCLUSAO -->   <h:outputText value="Investigador"
   style="font-family: arial,verdana;font-size: medium;color:darkblue" />
  <rich:panel>
   <rich:panel>
    <h:panelGrid columns="5">
     <h:outputText value="Nome" />
     <h:panelGroup>
      <h:inputText id="nome" maxlength="100"
       value="#{notificadorForm.strNmNotificador}" style="width: 300px">
       <rich:ajaxValidator event="onkeyup" />
      </h:inputText>
     </h:panelGroup>
     <h:outputText value="Unidade:" />
     <h:panelGroup>
      <h:selectOneMenu id="Unidade" required="true"
       requiredMessage=" Fornecedor é obrigatório."
       value="#{notificadorForm.isnEntidade}">
       <f:selectItems value="#{notificadorForm.sliEntidade}" />
      </h:selectOneMenu>
      <rich:message for="fornecedor">
       <f:facet name="errorMarker">
        <h:graphicImage value="IMG/error.gif" />
       </f:facet>
      </rich:message>
     </h:panelGroup>
     <!--inicio BOTAO -->
     <h:commandButton status="commonstatus" value="Buscar"
      action="#{notificadorForm.buscaNotificadorInvestigador}" />
     <!--FIM BOTAO -->
    </h:panelGrid>
   </rich:panel>
   <h:outputText value="Associar Investigador"
    style="font-family: arial,verdana;font-size: medium;color:darkblue" />
   <!--Tabela de notificação -->
   <rich:panel>
    <rich:dataTable id="dtNotificacao"
     onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
     onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
     value="#{notificadorForm.lstNotificador}" reRender="ds" var="ntf"
     border="0" cellpadding="1" cellspacing="1" rowKeyVar="linha"
     width="100%" rows="10">
     <f:facet name="header">
      <rich:columnGroup>
       <h:column>
        <h:outputText value="Cpf" style="width:10" />
       </h:column>
       <h:column>
        <h:outputText value="Num Conselho" style="width:10" />
       </h:column>
       <h:column>
        <h:outputText value="Nome" style="width:50" />
       </h:column>
       <h:column>
        <h:outputText value="Telefone" style="width:10" />
       </h:column>
       <h:column>
        <h:outputText value="Celular" style="width:10" />
       </h:column>
       <h:column>
        <h:outputText value="Investigador" style="width:10" />
       </h:column>       </rich:columnGroup>
     </f:facet>
     <rich:column>
      <h:outputText value="#{ntf.cpf}" />
     </rich:column>      <rich:column>
      <h:outputText value="#{ntf.numConselho}" />
     </rich:column>      <rich:column>
      <h:outputText value="#{ntf.nome}" />
     </rich:column>      <rich:column>
      <h:outputText value="#{ntf.telefone}" />
     </rich:column>      <rich:column>
      <h:outputText value="#{ntf.celular}" />
     </rich:column>      <rich:column>
      <Center>
          <h:selectBooleanCheckbox id="chec" value="#{ntf.flgInvestigador}">
          <rich:componentControl for="panel2" attachTo="chec" operation="show" event="onclick" />
          </h:selectBooleanCheckbox>
      </Center>
     </rich:column>      <!-- Paginação -->
     <f:facet name="footer">
      <rich:datascroller id="ds" ajaxSingle="false" />
     </f:facet>
    </rich:dataTable>
   </rich:panel>
  </rich:panel>
 </h:form>
</f:view>
</body>
</html>
Desde já agradeço   Atenciosamente Ricardo Barcelos.
Barcelos.java

Barcelos.java

Curtidas 0

Respostas

Davi Costa

Davi Costa

20/12/2010

Acredito que com essa alteração já funcione:

<rich:column>
      <Center>
          <h:selectBooleanCheckbox id="chec" value="#{ntf.flgInvestigador}">
             <f:setPropertyActionListener value="#" target="#{associarInvestigadorForm.objNotificador}"/>
          <rich:componentControl for="panel2" attachTo="chec" operation="show" event="onclick" />
          </h:selectBooleanCheckbox>
      </Center>
 </rich:column>

Espero ter ajudado

Att Davi
GOSTEI 0
Barcelos.java

Barcelos.java

20/12/2010

Obrigado Davi, mas ainda não conseguimos.   e o pior de tudo é que não dá nenhuma mensagem,   vc teria uma outra maneira de pegar essa linha?   Desde já agradecemos qualquer ajuda.   Att R. Barcelos
GOSTEI 0
Davi Costa

Davi Costa

20/12/2010

Ok, me explica melhor só que vc quer fazer:


<rich:column>
      <Center>
          <h:selectBooleanCheckbox id="chec" value="#{ntf.flgInvestigador}">
             <f:setPropertyActionListener value="#" target="#{associarInvestigadorForm.objNotificador}"/>
                    </h:selectBooleanCheckbox>
      </Center>
 </rich:column>

Se notar retirei uma tag daí. Mas realmente preciso entender um pouco mais, você quer que aconteça algo quando marcar o checbox ou só quando apertar o botão e submeter algo?

Abaixo segue um exemplo de código somente com as tags jsf que funciona numa boa:

<h:commandLink
                    action="#{DiarioFaces.updateDiarioInit}" value="Editar">
                    <f:setPropertyActionListener target="#{DiarioFaces.selectedDiario}"
                        value="#" />
                </h:commandLink>

Nesse caso vou editar essa linha da tabela.


Att Davi
GOSTEI 0
Dyego Carmo

Dyego Carmo

20/12/2010

Funcionou amigo ?

GOSTEI 0
Barcelos.java

Barcelos.java

20/12/2010

ok, deu certo, obrigado e desculpe pelo atrazo do feedback.
GOSTEI 0
POSTAR