sorting columns that aren't bound to a dataprovider
Hello,
In a table of fields that are mostly bound to a dataprovider, I have one column of labels, bound to an object of my own making. It was not automatically made sortable by studio creator, and my attempts to make it sortable using a SortCriteria object failed. This is because I don't have a fieldkey that I can use (should I?), and despite my reading, I still don't know much about sorting in general.
Does anyone know how I can make my column sortable?
Thanks,
Tristan
[507 byte] By [
apersona] at [2007-11-26 16:09:36]

# 3
1. You have a label component in a table. (or possibly a static text component)
2. You've set up the binding. Your label displays correctly.
3. If you have a look in your JSP the label component will have a text="#{something or the other}" in the <ui:label...../> tag.
Try change the sort= property of your table column to match the "#{something or the other}" of your label.
# 4
Thanks for the help, but that didn't seem to be right. <ui:tableColumn binding="#{pages$tables$altiTable.tableColumn14}" headerText="Status" id="tableColumn14">
<ui:label binding="#{pages$tables$altiTable.label1}" id="label1" sort="#{pages$tables$altiTable.drm.status}" text="#{pages$tables$altiTable.drm.status}"/>
</ui:tableColumn>
Lead to the exception:
Exception Details: org.apache.jasper.JasperException
/pages/tables/altiTable.jspf(14,175) Attribute sort invalid for tag label according to TLD
# 5
<ui:tableColumn binding="#{pages$tables$altiTable.tableColumn14}" headerText="Status" id="tableColumn14" sort="#{pages$tables$altiTable.drm.status}">
<ui:label binding="#{pages$tables$altiTable.label1}" id="label1" text="#{pages$tables$altiTable.drm.status}"/>
</ui:tableColumn>
This should work
# 6
Thanks for the reply yossarian. It still doesn't *quite* work yet though. When I load the page, that code causes a null pointer exception. I believe this is because drm is still null, but even when I have the drm constructed at the beginning of the init() method, I still get the exception.
Do you have any ideas?
Thanks,
Tristan
# 7
Sorry, no idea why you'd get a null pointer. What started out as a quick fix has dragged on a bit. You may have a lifecycle issue or I could be completely off track (could you define your data at the sessionbean level?) Also maybe try it outside of a page fragment -- ie try it in a normal page to eliminate that.
Your next avenue is probably: com.sun.rave.web.ui.component.TableColumnBase
and TableColumn which is it's decendant. The javadoc has a bunch of stuff on setting up sorting and sort criteria and so forth. Good luck!.
Message was edited by:
yossarian