Index: trunk/grails-app/taglib/CustomTagLib.groovy
===================================================================
--- trunk/grails-app/taglib/CustomTagLib.groovy	(revision 416)
+++ trunk/grails-app/taglib/CustomTagLib.groovy	(revision 417)
@@ -125,3 +125,66 @@
     } // checkBoxList
 
+    def sortableColumnWithImg = { attrs, body ->
+        def writer = out
+        if(!attrs.property)
+            throwTagError("Tag [sortableColumn] is missing required attribute [property]")
+
+//         if(!attrs.title && !attrs.titleKey)
+//             throwTagError("Tag [sortableColumn] is missing required attribute [title] or [titleKey]")
+
+        def property = attrs.remove("property")
+        def action = attrs.action ? attrs.remove("action") : (actionName ?: "list")
+
+        def defaultOrder = attrs.remove("defaultOrder")
+        if(defaultOrder != "desc") defaultOrder = "asc"
+
+        // current sorting property and order
+        def sort = params.sort
+        def order = params.order
+
+        // add sorting property and params to link params
+        def linkParams = [:]
+        if(params.id) linkParams.put("id",params.id)
+        if(attrs.params) linkParams.putAll(attrs.remove("params"))
+        linkParams.sort = property
+
+        // determine and add sorting order for this column to link params
+        attrs.class = (attrs.class ? "${attrs.class} sortable" : "sortable")
+        if(property == sort) {
+            attrs.class = attrs.class + " sorted " + order
+            if(order == "asc")
+                linkParams.order = "desc"
+            else
+                linkParams.order = "asc"
+        }
+        else
+            linkParams.order = defaultOrder
+
+        // determine column title
+//         def title = attrs.remove("title")
+//         def titleKey = attrs.remove("titleKey")
+//         if(titleKey) {
+//             if(!title) title = titleKey
+//             def messageSource = grailsAttributes.getApplicationContext().getBean("messageSource")
+//             def locale = RCU.getLocale(request)
+// 
+//             title = messageSource.getMessage(titleKey, null, title, locale)
+//         }
+
+        // Image.
+        def imgSrc = attrs.remove("imgSrc")
+        def imgAlt = attrs.remove("imgAlt")
+        def img = "<img src=${imgSrc} alt=${imgAlt} />"
+
+        writer << "<th "
+
+        // process remaining attributes
+        attrs.each { k, v ->
+            writer << "${k}=\"${v.encodeAsHTML()}\" "
+        }
+        writer << ">${link(action:action, params:linkParams) { img } }"
+//         writer << body()
+        writer << "</th>"
+    }
+
 } // end class
