You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Patrick Casey <pa...@adelphia.net> on 2005/04/18 21:38:40 UTC

Column Sorting

	Hi Folks,

	Thanks again for all the help with my questions to date ☺. I have a new question though (more of a request for advice really).

	I have set up a system where I have a “generic” list form that takes as its input a list of objects (theObjects) and a list of property names (theNames) and then proceeds to use the names as column titles and accessor methods. Example:

	Given this object definition:

	Solider (name, rank, serial_number)

	This list of objects:

	{Patton, General, 4}
	{Benjamin, Private, 6}

	And this List of properties:
	{rank, name}

	I output a list that looks like:

	Rank:		Name:
	General	Patton
	Private	Benjamin

	It works fine.

	Now, however, I want to add sorting behavior to the column headers. I read through my (somewhat dog eared) copy of tapestry in action, but the section on column sorting seems to be based on the assumption I know at design time what class of objects and what properties will be on screen at runtime (which I won't). So it appears I won't be able to use the built in sortColumn code (maybe I'm wrong here, if there's a way I'd love to hear it).

	Traditionally my solution to this problem was to hide a <form> on screen, put a javascript "onClick" handler on each <th> item and then programmatically submit the hidden form after setting its hidden "sort" field to indicate the column which was just clicked upon. I can do this again if I have to, but it strikes me as a decidedly "un-tapestryish" approach to the problem.

	Can anyone suggest a more paradigm appropriate solution here? Some sort of bodged directlink approach (make the <th> into directlinks and stuff their column names in as parameters)? Is there a way to make the sortColumn approach work for me? Something else entirely?

	--- Pat



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org