[ 
http://issues.apache.org/jira/browse/TOMAHAWK-550?page=comments#action_12421875 
] 
            
Catalin Kormos commented on TOMAHAWK-550:
-----------------------------------------

Ok, actualy you won't need to take the latest from SVN.  Here is an improved 
workarround:

<t:dataTable var="user" value="#{usersBean.users}"
                       sortAscending="#{sortDirections.users}">
        <t:column sortable="true" 
defaultSorted="#{sortColumns.settings['name']}">
                <f:facet name="header">
                        <t:commandSortHeader columnName="name" 
propertyName="name">
                                <h:outputText value="Name "/>
                                <t:updateActionListener 
property="#{sortColumns.settings['name']}" value="true"/>
                        </t:commandSortHeader>
                </f:facet>
                <h:outputText value="#{user.name}" 
styleClass="#{disablableStyles[user.disabled]}"/>
        </t:column>
       ....(more columns here) 

So, you have the "defaultSorted" attribute's value by column name in a Map, and 
you update those values as the user clicks on the sort header with the 
<t:updateActionListener> component. Note that you'll need also a custom Map 
that sets only one key's value to true, something like the following:

    public class CustomMap extends HashMap
    {
        public Object put(Object key, Object value)
        {
            Iterator it = keySet().iterator();
            while (it.hasNext())
            {
                super.put(it.next(), Boolean.FALSE);
            }

            return super.put(key, Boolean.valueOf(value.toString()));
        }
    }

Of course it will be better to have the sort property updated along with the 
sort column name. I hope you'll find this usefull until the bug is resolved.

Regards,
Catalin

> Sort property of sortable table is null when sort column is set.
> ----------------------------------------------------------------
>
>                 Key: TOMAHAWK-550
>                 URL: http://issues.apache.org/jira/browse/TOMAHAWK-550
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Extended Datatable
>    Affects Versions: 1.1.3
>         Environment: JBoss4.0.4.GA
>            Reporter: Alexander Slobodyanik
>
> If sortColumn attribute of dataTable with autosort feature enabled is set to 
> not-null value (for example, if it is stored in session-scope bean), then 
> sortProperty is not set and sorting is not performed.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to