yes, i've done it several times.

the decorator is something like this:

public class LinkJavascriptWrapper implements ColumnDecorator {
private static MessageResources messages = 
MessageResources.getMessageResources("ApplicationResources");
public String decorate(Object columnValue) {
 columnValue, String pParamter) throws DecoratorException {
String detailsString = messages.getMessage(Locale.getDefault(), "web.details.jsp");

        return "<a href=\"#\" onclick=\"javascript:openWindow('" + columnValue + 
"');return false;\" class=\"standard\">" + detailsString + "</a>";
    }
}

and in the page that uses the decorator:

<script language="JavaScript">
<!--
        function openMoveWindow(index) {
                var height = screen.height;
                var width = screen.width;
                var leftpos = width / 2 + 70;
                var toppos = height / 2 - 400;
        var winOpen;

                winOpen = 
window.open("/trade/move.jsp?"+index,"","toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0,width=300,height=210,left=300,top=300,left='+
 leftpos+',top='+toppos");
        return false;
        }
//-->
</script>

----
and 

<display:column title="<%=ldetails%>" property="accountPosIdLink" align="left" 
decorator="xxxxxx.LinkJavascriptWrapper" width="5%"/>

the accountPosIdLink property I have built up in my record object to be:

public String getAccountPosIdLink() {
        return new String("companyName=" + accPos.getCompanyName() + "&accountName=" + 
accPos.getAccountName() + "&instr=" + accPos.getInstrumentSeriesName());
    }

-----
Maybe this is a bit more than you need, is so, you can skip some of the stuff :-)

Regards,
Bard

----- Original Message -----
From: [EMAIL PROTECTED]
Date: Tue, 15 Jun 2004 08:58:36 -0400
To: [EMAIL PROTECTED]
Subject: Re: [displaytag-user] javascript

> I bet you can do this with a Column Decorator: 
> http://displaytag.sourceforge.net/apidocs/org/displaytag/decorator/ColumnDecorator.html
> 
> "The decorate method is responsible for transforming the object into a 
> string to render in the page. "
> 
> 
> 
> 
> 
> Saraschand Koiri <[EMAIL PROTECTED]> 
> Sent by: [EMAIL PROTECTED]
> 06/14/2004 10:40 AM
> Please respond to
> [EMAIL PROTECTED]
> 
> 
> To
> [EMAIL PROTECTED]
> cc
> 
> Subject
> [displaytag-user] javascript
> 
> 
> 
> 
> 
> 
> Hello,
> 
> I have just been using your displaytag work, which is
> really cool.
> 
> However I have come across a situation which requires
> a column to display a html link that has some
> javascript code attached to it
> ie. <A HREF="#"
> onclick="selectedSalesOrder('45')">Select</A>
> 
> Is there anyway to specify the link in the displaytag
> table column with custom code?
> 
> Regards
> 
> 
> 
>  
>  
>  
> ___________________________________________________________ALL-NEW Yahoo! 
> Messenger - sooooo many all-new ways to express yourself 
> http://uk.messenger.yahoo.com
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
> Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
> Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
> REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
> _______________________________________________
> displaytag-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/displaytag-user
> 

-- 
_____________________________________________________________
Web-based SMS services available at http://www.operamail.com.
>From your mailbox to local or overseas cell phones.

Powered by Outblaze


-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
_______________________________________________
displaytag-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to