jquery - Datatables row id in JavaScript -


i id of datatables row call click() on hidden button in same table cell. done way because buttons have h:commandbutton , couldn't force p:commandbutton them. , h:commandbutton doesn't have oncomplete event. know use datamodel, there way (using js, jquery)? when put hardoced id (p:table:4:hiddenbutton) ok, how row number each cell??

<h:form id="p">  <h:datatable value="#{bean.paymentlist}" var="pmt" id="table" >    ...     <h:column>     <f:facet name="header">       <h:outputtext value="#{bundle.action}" />      </f:facet>      <h:commandbutton  type="button" value="#{bundle.approve}"              onclick="document.getelementbyid('p:table:??:hiddenbutton').click();" />       <p:commandbutton  id="hiddenbutton" value="hidden" style="display: none;"        oncomplete="if (#{pmt.errorsnum} > 0) {        return conferrdial.show();        } else {        return confdial.show();};">       <f:setpropertyactionlistener value="#{pmt.id}" target="#{bean.holder}" />       </p:commandbutton>      </h:column>  </h:datatable> </h:form> 

edit:

ok did trick using jquery, may not nice works.

what did: added id h:commandbutton , on onclick event id of h:commandbutton , replace id id of hidden p:commandbutton, code now:

<h:commandbutton id="button" type="button" value="#{bundle.approve}"  onclick="document.getelementbyid(($(this).attr('id')).replace('button','hiddenbutton')).click();" 

still maybe knows better solution.

ps: strange because $(this).parent().attr('id') null. think has no element created id p:table:0 p:table:1 etc...


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -