Ali Batur Ali Batur - 1 month ago 13
jQuery Question

Selecting column / SyntaxError: function statement requires a name

I'm working on a project with PrimeFaces template.
In p:datatable, i want to select a column's content.
I tried Jquery to do this

$(document).on('click','td[role=gridcell]',function(){; });

but got this SyntaxError: function statement requires a name.
Columns like this;

<p:column sortBy="#{byn.referans}" filterBy="#{byn.referans}"
filterMatchMode="contains" filterEvent="enter" >
<f:facet name="header">#{msg['beyanname.tablecolumn.referans']}</f:facet>
<h:outputText value="#{byn.referans}" />


give your p:dataTable / editable="false" and change h:outputText to h:inputText. Your column should be like this.

<h:inputText value="#{byn.referans}" readonly="true" styleClass="selectable-column"/>    

Then in your stylesheet, make the column's cell look like a normal cell.

.selectable-column {width: 100%; background-color: transparent; border: none;}