I'm trying to get the id of the first column of a TreeTable Primefaces with JS. But when I click on the corresponding line, I can get to the js function, but I always get only id 1, I can not get the other id's for the selected line. NOTE: If someone knows another way to rescue this id, not being with js, it would be of great help. some way with jsf itself in ManagedBean would be more practical I believe
Follow column of first column of primefaces
<p:column headerText="Nome" style="width: 500px">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{document.namePasta}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{document.namePasta}" label="Nome"
style="width:100%" />
<input type="hidden" name="idBancoPasta" id="idBancoPasta"
value="#{document.idBancoPasta}" />
</f:facet>
</p:cellEditor>
</p:column>
Note that I have the input type="hidden" that contains the id that I need to retrieve
Here is the last column actions that makes the call to js
<h:outputLink id="fade_folder" value="#">
<h:commandButton
onclick="PF('modalSubPasta').show(); getIdInputHidden(); return false"
image="../resources/img/folder.png"
rendered="#{document.type == 'Pasta' || document.type == 'Sub-Pasta'}"
style="width: 25px; margin: 5px" />
</h:outputLink>
There I have an onclick calling function getIdInputHidden (); Now the function js that only rescues id 1
function getIdInputHidden() {
var idInput = document.getElementById('idBancoPasta').value;
alert(idInput);
}