Displaytag table exported header column contains span tags

Posted by Lancelot on Stack Overflow See other posts from Stack Overflow or by Lancelot
Published on 2010-05-07T22:28:04Z Indexed on 2010/05/07 22:38 UTC
Read the original article Hit count: 589

Filed under:
|
|
|

Hi,

When I export the content of the display tag table I use the data shows up fine, but the header cells are surrounded by html span tags, which is slightly annoying.

I can imagine why Displaytag uses spans around the column header's text, but it shouldn't transpose in the exported data I think.

Here is my displaytag.properties config related to export:

# Export
export.amount = list
export.decorated = true
export.banner=<div id="exportTypes"><span class="label">Export: </span>{0}</div>
export.banner.sepchar=&nbsp;|
export.types=excel csv xml
export.excel=true
export.csv=true
export.xml=false
export.excel.label=xls
export.csv.label=csv
export.xml.label=xml
export.excel.filename=export.xls
export.csv.filename=export.csv
export.xml.filename=export.xml
export.excel.include_header=true
export.csv.include_header=true
export.xml.include_header=true

Here is the displaytag table itself:

<display:table
   class="list sortable"
   defaultsort="1"
   export="true"
   htmlId="contacts"
   id="row" 
   name="contacts" 
   requestURI="">

   <display:setProperty name="export.banner"><div id="exportTypes"><span class="label">Export:</span> {0}</div></display:setProperty>
   <display:setProperty name="export.csv.filename">CSV</display:setProperty>
   <display:setProperty name="export.excel.filename">XLS</display:setProperty>
   <display:setProperty name="basic.msg.empty_list_row">
    <tr class="empty">
     <td colspan="7">Empty</td>
    </tr>
   </display:setProperty>

   <display:column class="lastName" property="lastName" sortProperty="lastName" headerClass="lastName first" sortable="true" titleKey="Lastname" href="contact/view" paramId="contactId" paramProperty="id" />
   <display:column property="firstName" class="firstName" headerClass="firstName" sortable="true" titleKey="FirstName" />
   <display:column class="loginName" headerClass="loginName" sortable="true" titleKey="Username" />
</display:table>

My problem is when I click export on either the CSV or the XLS format the header row in the generated file looks like this:

<span>Last Name</span> <span>First Name</span> <span>Username</span>

I really don't want those span tags in there, any way to work around that?

Thanks

© Stack Overflow or respective owner

Related posts about displaytag

Related posts about header