简体   繁体   中英

primefaces dataTable:how to hide column

I want to hide some columns in a dataTable(eg id,serial),the columns will be rendered because javascript need access the value of the columns. Any idea?

You can use display: none or visibility: hidden . You can find the difference in here: What is the difference between visibility:hidden and display:none?

Whatever you use, you will have access with javascript to those elements.

Also you can find here a interesting point of view regarding the usage of display:none .

Just set the "rendered" attribute to "false":

<p:column rendered="false">
...
</p:column>

If you are using Prime NG, for angular, in p-column you can add attribute [hidden]="true". That solved my issue. Also, that column will show up in export CSV function which is kind of cool.

您是否尝试过:

<p:column style="display: none" //...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM