I got a bit carried away with enthusiasm ;-(

What I got it to work yesterday only had one row in the table (the single
thus last row in the table!).  However, on trying it with multiple rows in
the table I realised that I cannot get at the correct row object.

My 

tstronge wrote:
> 
>         String fieldValue = evaluate(listObjFieldName,
> ctxt.getAttribute("tableRow")).toString();
> 

doesn't work because ctxt.getAttribute("tableRow") gives me the item in the
last row of the table and not the item that's being selected by the user
clicking on the link.

So I'm back to square 1
- I can't use a TableDecorator as I don't know the column name up front to
write a getSomeColumnName() method in the table decorator
- I can't use a ColumnDecorator as I can't access values other than the
column in question

Any help really appreciated on this as I am losing hairs by the hour!!

My latest (failed!) attempt has


>   public Object decorate(Object columnValue, PageContext ctxt,
> MediaTypeEnum mt) throws DecoratorException {
>     String returnAssignmentsStr = "";
> 
>     String[] returnValueAssignmentPairs = (String[])
> ctxt.getAttribute("returnValueAssignmentPairs");
> 
>     for (int i = 0; i < returnValueAssignmentPairs.length; i++) {
>       String parentObjFieldName =
> returnValueAssignmentPairs[i].split("=")[0];
>       String listObjFieldName =
> returnValueAssignmentPairs[i].split("=")[1];
> 
>       String fieldValue = evaluate(listObjFieldName,
> ctxt.getAttribute("selection")).toString();
> 
>       returnAssignmentsStr = returnAssignmentsStr + parentObjFieldName +
> "=" + fieldValue;
>       if (i < returnValueAssignmentPairs.length - 1) {
>         returnAssignmentsStr += ";";
>       }
>     }
> 
>     return "&lt;a href=\"#\" class=\"DATA-LINK\"
> onclick=\"javascript:populate_parent('" + returnAssignmentsStr +
> "')\"&gt;"
>         + columnValue.toString() + "&lt;/a&gt;";
>   }
> 

in the ColumnDecorator and 



>       <display:column media="html" 
>       property="${columnName}"
>                               .... blah ....
> decorator="com.XXXX.XXXX.XX.web.decorator.ReturnValueLinkColumnDecorator"
> >
>      </display:column>
> 
in the JSP
-- 
View this message in context: 
http://www.nabble.com/Using-Link-on-Column-to-populate-fields-%28plural%21%29-in-parent-screen-tf4811614.html#a13858332
Sent from the DisplayTag - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to