Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    LinkItem make visited in the run-time

    I have the following code:

    Code:
    final LinkItem link = new LinkItem( );
    link.setEndRow( true );
    link.setShowTitle( false );
    link.setLinkTitle("linkTitle");
    
    link.addClickHandler( new ClickHandler(){
    
    @Override
    public void onClick( ClickEvent event ) {
    //do something on my page
    final LinkItem item = (LinkItem)event.getItem();
    event.cancel();
    }
    
    });
    I want to mark the link as visited after user clicked it.
    Before the click the link is "blue", after the click I want it to be "brown" to look as all visited links do in the browser.
    How can I do it ? Is my only option the
    Code:
    item.setCellStyle
    ?
    I use SmartClient Version: v10.1p_2016-01-07/PowerEdition Deployment (built 2016-01-07)

    #2
    The styling of the link element isn't coming from CSS - it's the browser's default styling for <a> elements. So if you applied a CSS style to the containing cell or containing textBox element (see formItem.textBoxStyle), the link would remain styled with the browser's default styling for links.

    To do what you want, you could create a readOnly TextItem where a ValueFormatter outputs an <a> with a <span> around the link text that applies a CSS style specifically to the link text. Then that CSS style would actually override the browser's default link styling.

    We'd advise you to carefully think through whether this is worthwhile - it's unclear where you plan to store the information on whether a link has been visited before, or for how long, but that aspect could get complicated.

    Comment

    Working...
    X