I have a display:table in my selection list that displays in an IFrame after the user clicks on a button beside a field in the parent window. The display:table is built up dynamically from a pre-prepared displayListDescriptor which has a list of column descriptors (i.e. my JSP iterates each columnDescriptor item in my command.displayListDescriptor.displayColumnDescriptors).
I want data from the table row selected to be returned to (potentially multiple) fields on the parent screen. Attributes of my Spring Web MVC command object specify: - which column will be the "link column" so when command.linkField==columnDescriptor.name, I try to do a href with onclick="javascript:populate_parent(XXX)" - where XXX would somehow indicate what value should be assigned to which field - a returnValueAssignmentPattern (e.g. "parentUserId=userId;userName=name;someOtherParentField=SomeOtherField" where the left-hand-side of each assignment represents a field on the parent object & the right-hand-side of each assignment represents a field on the object that's being listed in my table. I assign value="${model.objectsList.list[selection_rowNum-1]}" to a "tableRow" var (table id="selection") Previously this was only trying to return the value from the single selected column - so returnValueAssignmentPattern would have been simply parentUserId=userId & XXX was the value of the column ${tableRow[columnDescriptor.name]} - userId column in this example. I am now trying to populate n fields on the parent screen from values in different columns in the row. I thought I'd try to call the javascript with onclick="javascript:populate_parent('${returnAssignmentsStr}') where the the returnAssignmentsStr parameter to the populate_parent() javascript function looks something like "parentUserId=CrazyDude;userName=Crazy Dude;someOtherParentField=SomeOtherValue" Remember my returnValueAssignmentPattern is "parentUserId=userId;userName=name;someOtherParentField=SomeOtherField" Fields on the object being listed in the table would be - userId=CrazyDude - name=Crazy Dude - someOtherField=SomeOtherValue" I haven't been able to make this work though... I may need to use Decorators rather than try to do it in the JSP - I can't use ColumnDecorator as I need information from other columns in the row. - I can't work out how to use a TableDecorator though as examples I see (for example, on http://displaytag.homeip.net/displaytag-examples-1.1/example-decorator.jsp) expect that I know the name of the column (date, money etc. in example I link) & know the object type and write, for example, getDate() or getMoney() methods that call getCurrentRowObject() & do stuff (knowing what the object class is). My decorated object could be any of a User DTO, a Product DTO or any other DTOs in our system - I could probably work something out using reflection but I feel as though that's going in circles as User.userId was already easily accessible to me in the JSP by simply saying ${tableRow['userId']}). I've tried some c:forEach looping in the JSP but don't think I can get it to work in the scope of the display:column tag. I note that the TableDecorator init takes (PageContext context, Object decorated, TableModel tableModel) params so there may be something useful I can do in with PageContext etc. Can I get the object info in a map so I can still say tableRow['userId'] / tableRow[someColName] & not have to work with the full object? Thing is that I'm relatively new to JSP/Servlet stuff (less than a year) & even newer to displaytag library so am not very well versed in what my options are. Has anyone written any decorators / tags etc. to solve problems along these lines? Or am I missing something obvious about how this sort of thing should be done? Nothing would surprise me! -- View this message in context: http://www.nabble.com/Using-Link-on-Column-to-populate-fields-%28plural%21%29-in-parent-screen-tf4811614.html#a13766855 Sent from the DisplayTag - General mailing list archive at Nabble.com. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ displaytag-user mailing list displaytag-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-user