I want to know how do I get a column selection
I have the following datatable
<p:dataTable id="DataTable" value="#{dataTable.selecDataModel}" var="test" scrollable="TRUE" scrollHeight="500" styleClass="day-column2" selectionMode="single" >
<p:column headerText="Column1" footerText="Column1" width="450">
<h:outputText value="Test1" />
</p:column>
<p:column headerText="Column2" footerText="Column2" width="450">
<h:outputText value="Test2" />
</p:column>
</p:dataTable>
The p:ajax only support row selection, if I would like to know which column is selected, how do I get the same.
You can find out the index of the selected column with jQuery and send it to server as an ajax event
here is a way:
first add an
inputTextabove the table (make it hidden)and the following js code to bind clicking on the table and triggering click on the
h:inputTextwhich will trigger listened on the serverUpdate
What I actually meant was the following structure:
and inside the js (place it inside js folder inside resources folder in the root of your web app folder Resources (Library) In JSF 2.0) file place