Can I hide a column in displaytag using media='none'

ashwinsakthi picture ashwinsakthi · Sep 24, 2012 · Viewed 11.2k times · Source

Can i hide a column in displaytag using media='none'? Will there be any other consequences due to this as am using the value from the hidden column in another column of the displaytag as a parameter to a hyperlink.

I succeeded in hiding the column but get the foll: warning in the server logs

W org.displaytag.tags.ColumnTag setMedia Unrecognized value for attribute "media" value="none"

I tried using class as hidden but it didn't workout so i went ahead with media as none and it worked.


   <table border="1"  width="100%"   align="center" cellpadding="0" cellspacing="1"    class="table_main">


<display:table name="requestScope.ITIReportForm.rprtData" id="table" export="true" sort="list" requestURI="/itireport.do"   pagesize="20" align="center"  class="table_main" width="100%">

<display:column width="5%"  align="center" media="html" titleKey="" headerClass="table_header" title="Request No">
<a href="/apeweb/homesubmit.do?method=showRequest&requestNo=<%=((ITIReportVO)table).getReqNo()%>&reqStatus=<%=((ITIReportVO)table).getStatusreq()%>&reqType=<%=((ITIReportVO)table).getTypeofrequest()%>"><%=((ITIReportVO)table).getReqNo()%></a>
</display:column>

<display:column width="5%"  align="center" class="hidden" media="Excel" title="Request No" headerClass="table_header" >
<%=((ITIReportVO)table).getReqNo()%>
</display:column>
<display:column  class="hidden" property="statusreq" title="Status" headerClass="table_header" width="16%" align="center" media ="none"/>
<display:column  class="label_text" property="typeofrequest" title="Req Type" headerClass="table_header" width="10%" align="center"/>
<display:column  class="label_text" property="cdsID" title="CDSID" headerClass="table_header" width="6%" align="center"/>
<display:column  class="label_text" property="ll6CdsID" title="LL6 CDSID" headerClass="table_header" width="6%" align="center"/>
<display:column  class="label_text" property="requestStatus" title="Request Status" headerClass="table_header" width="6%" align="center"/>
<display:column  class="label_text" property="creationDate" title="Creation Date" headerClass="table_header" width="6%" align="center"/>
<display:column  class="label_text" property="assgnITI" title="Assigned to ITI" headerClass="table_header" width="6%" align="center"/>
<display:column  class="label_text" property="assgnAsstAdm" title="Assigned to Asset Admin" headerClass="table_header" width="6%" align="center"/>
<display:column  class="label_text" property="assgnHlpDsk" title="Assigned to Help Desk" headerClass="table_header" width="6%" align="center"/>
<display:column  class="label_text" property="closdDate" title="Closed Date"  headerClass="table_header" width="6%" align="center"/>
<display:setProperty name="export.xls.filename" value="rprtData.xls"/>
<display:setProperty name="css.tr.even" value="row1" />
<display:setProperty name="css.tr.odd" value="row2" />
<display:setProperty name="paging.banner.placement" value="bottom" />
<display:setProperty name="basic.msg.empty_list"  value="No Records Found" />

 </display:table>
</table>

@ alfasin ...Here is my code...I tried using class as hidden but it didn't workout so i went ahead with media as none and it worked.

   <table border="1"  width="100%"   align="center" cellpadding="0" cellspacing="1"    class="table_main">


<display:table name="requestScope.ITIReportForm.rprtData" id="table" export="true" sort="list" requestURI="/itireport.do"   pagesize="20" align="center"  class="table_main" width="100%">

<display:column width="5%"  align="center" media="html" titleKey="" headerClass="table_header" title="Request No">
<a href="/apeweb/homesubmit.do?method=showRequest&requestNo=<%=((ITIReportVO)table).getReqNo()%>&reqStatus=<%=((ITIReportVO)table).getStatusreq()%>&reqType=<%=((ITIReportVO)table).getTypeofrequest()%>"><%=((ITIReportVO)table).getReqNo()%></a>
</display:column>

<display:column width="5%"  align="center" class="hidden" media="Excel" title="Request No" headerClass="table_header" >
<%=((ITIReportVO)table).getReqNo()%>
</display:column>
<display:column  class="hidden" property="statusreq" title="Status" headerClass="table_header" width="16%" align="center" media ="none"/>
<display:column  class="label_text" property="typeofrequest" title="Req Type" headerClass="table_header" width="10%" align="center"/>
<display:column  class="label_text" property="cdsID" title="CDSID" headerClass="table_header" width="6%" align="center"/>
<display:column  class="label_text" property="ll6CdsID" title="LL6 CDSID" headerClass="table_header" width="6%" align="center"/>
<display:column  class="label_text" property="requestStatus" title="Request Status" headerClass="table_header" width="6%" align="center"/>
<display:column  class="label_text" property="creationDate" title="Creation Date" headerClass="table_header" width="6%" align="center"/>
<display:column  class="label_text" property="assgnITI" title="Assigned to ITI" headerClass="table_header" width="6%" align="center"/>
<display:column  class="label_text" property="assgnAsstAdm" title="Assigned to Asset Admin" headerClass="table_header" width="6%" align="center"/>
<display:column  class="label_text" property="assgnHlpDsk" title="Assigned to Help Desk" headerClass="table_header" width="6%" align="center"/>
<display:column  class="label_text" property="closdDate" title="Closed Date"  headerClass="table_header" width="6%" align="center"/>
<display:setProperty name="export.xls.filename" value="rprtData.xls"/>
<display:setProperty name="css.tr.even" value="row1" />
<display:setProperty name="css.tr.odd" value="row2" />
<display:setProperty name="paging.banner.placement" value="bottom" />
<display:setProperty name="basic.msg.empty_list"  value="No Records Found" />

 </display:table>
</table>

Answer

prem30488 picture prem30488 · May 8, 2014

media='none' is same as media='abc'.

Reason it finds 'abc' (or any string) as [mymedia]

You should Use

<display:column property="index" title="" class="hidden" headerClass="hidden" /> 

And in your CSS file.

.hidden {
 display: none;
}