Hi Ed

I explored the option of "another column that's always there" yesterday so I
could have a getMagic() - to use Ed's terminology - method in a
TableDecorator but hit a couple of problems with it:

- The empty column always displayed in the list - I couldn't work out how to
do a hidden column as such - there was another post by someone on this
subject some time ago
(http://www.mail-archive.com/displaytag-user@lists.sourceforge.net/msg05162.html)
but I didn't see a solution

- I'd be slapped across the knuckles about "magic" not being a property of
the bean (my beans are any of a significant number of DTO objects &
introducing a magic field into the DTO for display purposes isn't really a
runner.  Is it possible to put a non-object field as a column in a
displaytag table?

However with a combination of a taglib function & javascript I have
something that works - so in the JSP I have:


>                <display:column media="html" 
>                                 blah...
>                         &lt;a href="#" 
>                      class="DATA-LINK" 
>                     
> onclick="javascript:populate_parent(&quot;${pfn:buildReturnValueSelectionStr(rowObject,returnValueAssignmentPairs)}&quot;)"&gt;
>                      <c:out value="${rowObject[columnName]}"/>                
>       
>                 </display:column>
> 

and my taglib function looks like:


>   public static String buildReturnValueSelectionStr(Object selectedObject,
> String[] assignmentPairs){
>     String returnAssignmentsStr = "";
>         
>     for (int i=0; i<assignmentPairs.length; i++){
>       String assignTo = assignmentPairs[i].split("=")[0];
>       String assignFrom = assignmentPairs[i].split("=")[1];
>       String fieldValue = evaluate(assignFrom, selectedObject).toString();
>       returnAssignmentsStr = returnAssignmentsStr + assignTo + "=" +
> fieldValue;
>       
>       if (i<assignmentPairs.length-1){
>         returnAssignmentsStr += ";";
>       }
>     }
> 
>     return returnAssignmentsStr;
>   }
> 

My evaluate() is like the evaluate() in TableDecorator (with the object
added as a param) & uses the displaytag LookupUtils.

It seems to be behaving as hoped.

Thanks for the suggestion Ed - if you've anything further to add on the
problems I encountered with trying to hide a column & have a non-object
field in the displaytag table, I'm all ears for future reference...

Thelma
-- 
View this message in context: 
http://www.nabble.com/Using-Link-on-Column-to-populate-fields-%28plural%21%29-in-parent-screen-tf4811614.html#a13861277
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