[ 
https://issues.apache.org/jira/browse/TAP5-2596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16380373#comment-16380373
 ] 

Svein commented on TAP5-2596:
-----------------------------

{color:#000080}I think it's to hard to do this by writing "magical" code. 
labelRaw("html") would be much nicer than digging into the more complex 
MarkupWriter or overriding  method.{color}

{color:#000080}I solved it this way:{color}

{color:#000080}void {color}onAfterRenderFromGrid(MarkupWriter writer) {
 setGridLabelRaw(writer.getElement(), {color:#008000}"Destinations"{color}, 
{color:#008000}"<span class='glyphicon 
glyphicon-thumbs-up'></span>Destina&shy;tions"{color});
}

{color:#000080}private void {color}setGridLabelRaw(Element ele, String 
propertyName, String rawValue) {
 String dataGridProp = 
ele.getAttribute({color:#008000}"data-grid-property"{color});
 {color:#000080}if {color}(ele.getName().equals({color:#008000}"th"{color}) && 
dataGridProp != {color:#000080}null {color}&& 
dataGridProp.equals(propertyName)) {
 ele.find({color:#008000}"a"{color}).removeChildren().raw(rawValue);
 }
}

> Grid header should also allow HTML
> ----------------------------------
>
>                 Key: TAP5-2596
>                 URL: https://issues.apache.org/jira/browse/TAP5-2596
>             Project: Tapestry 5
>          Issue Type: Improvement
>          Components: tapestry-core
>    Affects Versions: 5.4.3
>            Reporter: Svein
>            Priority: Major
>         Attachments: image-2018-02-28-10-07-20-662.png
>
>
> I have used <{color:#660e7a}p{color}{color:#000080}:xxxHeader{color}>, but 
> this needs an ugly hack to keep the sorting. I would like to set the header 
> value with <PropertyModel> destinations.labelRaw({color:#008000}"<span 
> class='glyphicon glyphicon-thumbs-up'></span>Desti­nations"{color});
>  
> GridColumns.tml may look like:
> <{color:#000080}thead 
> {color}{color:#0000ff}xmlns:{color}{color:#660e7a}t{color}{color:#008000}="http://tapestry.apache.org/schema/tapestry_5_3.xsd";
>  
> {color}{color:#660e7a}xml{color}{color:#0000ff}:space{color}{color:#008000}="default"{color}>
>  <{color:#000080}tr 
> {color}{color:#0000ff}data-inplace-grid-links{color}{color:#008000}="{color}{color:#000080}${{color}inplaceGridLinks\{color:#000080}}">
>  <{color:#000080}th 
> {color}{color:#660e7a}t{color}{color:#0000ff}:id{color}{color:#008000}="loop" 
> {color}{color:#660e7a}t{color}{color:#0000ff}:type{color}{color:#008000}="Loop"
>  {color}{color:#0000ff}source{color}{color:#008000}="columnNames" 
> {color}{color:#0000ff}value{color}{color:#008000}="columnName" 
> {color}{color:#0000ff}formstate{color}{color:#008000}="none"{color} 
> {color:#0000ff}index{color}{color:#008000}="index" 
> {color}{color:#660e7a}t{color}{color:#0000ff}:mixins{color}{color:#008000}="rendernotification"{color}>
>  <{color:#660e7a}t{color}{color:#000080}:delegate 
> {color}{color:#0000ff}to{color}{color:#008000}="blockForColumn"{color}/>
>  <{color:#660e7a}t{color}{color:#000080}:block 
> {color}{color:#0000ff}id{color}{color:#008000}="standardHeader"{color}>
>  <{color:#660e7a}t{color}{color:#000080}:unless 
> {color}{color:#0000ff}test{color}{color:#008000}="columnModel.labelRaw"{color}>
>  <{color:#000080}a 
> {color}{color:#660e7a}t{color}{color:#0000ff}:id{color}{color:#008000}="sort" 
> {color}{color:#0000ff}rel{color}{color:#008000}="nofollow"{color}>{color:#000080}${{color}columnModel.label\{color:#000080}}</a>
>  </{color:#660e7a}t{color}{color:#000080}:unless{color}>
>  <{color:#660e7a}t{color}{color:#000080}:if 
> {color}{color:#0000ff}test{color}{color:#008000}="columnModel.labelRaw"{color}>
>  <{color:#000080}a 
> {color}{color:#660e7a}t{color}{color:#0000ff}:id{color}{color:#008000}="sort" 
> {color}{color:#0000ff}rel{color}{color:#008000}="nofollow"{color}>
>  <{color:#660e7a}t{color}{color:#000080}:outputraw 
> {color}{color:#0000ff}value{color}{color:#008000}="columnModel.labelRaw"{color}/>
>  </{color:#000080}a{color}>
>  </{color:#660e7a}t{color}{color:#000080}:if{color}>
>  </{color:#660e7a}t{color}{color:#000080}:block{color}>
>  </{color:#000080}th{color}>
>  </{color:#000080}tr{color}>
>  </{color:#000080}thead{color}>
> !image-2018-02-28-10-07-20-662.png!
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to