Get line number in fonts that can be used by clicking button in line

how can I get the row number in Primefaces (2.2) DataTable by clicking a button on some row? I need to pass this number to javascript code with prompt () function.

1 solution

using WidgetVar.selection

, but in this case I am using manual row selection and then click -> bad script.

<p:column> <p:commandButton id="someButton" value="Button" actionListener="#{managedBean.someEvent}" onclick="return jsMethod(widgetVar.selection)" /> </p:column>

Thank!

+3


source to share


1 answer


You can use UIData#getRowIndex()

for this.



<p:dataTable binding="#{table}" ...>
    <p:column>
        <p:commandButton ... onclick="return jsMethod(#{table.rowIndex})" />
    </p:column>
</p:dataTable>

      

+4


source







All Articles