Wednesday, July 30, 2008

richfaces:dataTable:column sortBy

sortBy is a new richfaces capability that I mentioned previously. I've started to incorporate it into my system and what follows are some tips/notes/frustrations.

If the sorting glyphs appear, but nothing happens, the dataTable needs to be surrounded by < h: form> < / h:form> -- sorting doesn't work outside of a form context.

If the glyphs do not appear sortBy may not be being given a valid attribute for sorting. This may be the result of a simple typo e.g., sortBy="{}" rather than sortBy="#{}"

I had some very strange behavior in netbeans/seamonkey with this facility. For example, if I clicked on the sort glyph for id

I got

YES the header of the column changed to "comp_ID form ss" -- even though "comp_ID form ss" no longer appeared in the file.

It used to be there, but I had removed it and performed a "build" in NetBeans (rather than a "clean and build"). I'm not sure about the underlying cause of this, but in my mind the effect straddles the boundary between disconcerting and amusing. The bottom line is that if things start acting strangely do a "clean and build".

All in all sortBy is a real step forward: it works in ajax tabPanels and simplifies the xhtml code a great deal. Despite this warning, sorting has been working for me as expected.

1 comment:

Carlo said...

According to my experience there is no way to be "notified" of the fact that the user has requested a sortBy a certanin column. This takes to a strange behavior when you use an dataTable with a data scroller. You go to page 2 then order by a column.
Then you require a navigation end go back to the table page... you can keep the page selected, but no way to keep the sorting.