{"id":1042,"date":"2010-11-08T12:51:47","date_gmt":"2010-11-08T12:51:47","guid":{"rendered":"http:\/\/salientsoft.co.uk\/?p=1042"},"modified":"2010-11-08T12:53:49","modified_gmt":"2010-11-08T12:53:49","slug":"setting-column-headers-on-a-primefaces-table","status":"publish","type":"post","link":"https:\/\/salientsoft.co.uk\/?p=1042","title":{"rendered":"Setting Column Headers on a Primefaces Table"},"content":{"rendered":"<p>The normal way to add JSF table headers is to use a header facet :-<\/p>\n<p style=\"padding-left: 30px;\">&lt;p:column sortBy=&#8221;#{car.model}&#8221; &gt;<br \/>\n\u00a0\u00a0\u00a0 &lt;f:facet name=&#8221;header&#8221;&gt;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;h:outputText value=&#8221;Model&#8221; \/&gt;<br \/>\n\u00a0\u00a0\u00a0 &lt;\/f:facet&gt;<br \/>\n\u00a0\u00a0\u00a0 &lt;h:outputText value=&#8221;#{car.model}&#8221; \/&gt;<br \/>\n&lt;\/p:column&gt;<\/p>\n<p>In Primefaces tables, this can give column width and alignment issues in some cases, so the headerText attribute of the column should be used instead :-<\/p>\n<p style=\"padding-left: 30px;\">&lt;p:column headerText=&#8221;Model&#8221;\u00a0 sortBy=&#8221;#{car.model}&#8221;&gt;<br \/>\n\u00a0\u00a0\u00a0 &lt;h:outputText value=&#8221;#{car.model}&#8221; \/&gt;<br \/>\n&lt;\/p:column&gt;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The normal way to add JSF table headers is to use a header facet :- &lt;p:column sortBy=&#8221;#{car.model}&#8221; &gt; \u00a0\u00a0\u00a0 &lt;f:facet name=&#8221;header&#8221;&gt; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;h:outputText value=&#8221;Model&#8221; \/&gt; \u00a0\u00a0\u00a0 &lt;\/f:facet&gt; \u00a0\u00a0\u00a0 &lt;h:outputText value=&#8221;#{car.model}&#8221; \/&gt; &lt;\/p:column&gt; In Primefaces tables, this can give column width and alignment issues in some cases, so the headerText attribute of the column should be [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[22],"tags":[40,184,112,16],"_links":{"self":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1042"}],"collection":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1042"}],"version-history":[{"count":3,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1042\/revisions"}],"predecessor-version":[{"id":1045,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1042\/revisions\/1045"}],"wp:attachment":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1042"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1042"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1042"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}