You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Alexander Slobodyanik (JIRA)" <de...@myfaces.apache.org> on 2006/07/18 09:30:13 UTC

[jira] Created: (TOMAHAWK-550) Sort property of sortable table is null when sort column is set.

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

        

[jira] Commented: (TOMAHAWK-550) Sort property of sortable table is null when sort column is set.

Posted by "Catalin Kormos (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/TOMAHAWK-550?page=comments#action_12421836 ] 
            
Catalin Kormos commented on TOMAHAWK-550:
-----------------------------------------

Please explain the use case for which you need to set the sortColumn attribute of the dataTable to a non null value if autosort is enabled. Some code snippets would also help us understand your problem.

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

        

[jira] Commented: (TOMAHAWK-550) Sort property of sortable table is null when sort column is set.

Posted by "Alexander Slobodyanik (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/TOMAHAWK-550?page=comments#action_12421872 ] 
            
Alexander Slobodyanik commented on TOMAHAWK-550:
------------------------------------------------

Yes, I will try to build and use latest version from SVN trunk. 

Regards,
Alexander.

> 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

        

[jira] Commented: (TOMAHAWK-550) Sort property of sortable table is null when sort column is set.

Posted by "Martin Marinschek (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/TOMAHAWK-550?page=comments#action_12435653 ] 
            
Martin Marinschek commented on TOMAHAWK-550:
--------------------------------------------

Hi Catalin,

did you fix this in SVN? if yes, can you close the bug?

regards,

Martin

> 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
>         Assigned To: Catalin Kormos
>
> 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

        

[jira] Commented: (TOMAHAWK-550) Sort property of sortable table is null when sort column is set.

Posted by "Alexander Slobodyanik (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/TOMAHAWK-550?page=comments#action_12421880 ] 
            
Alexander Slobodyanik commented on TOMAHAWK-550:
------------------------------------------------

Ok, this surely must work. The only trouble is that it forces me to have one map instance, holding defaultSorted attribute values, for every autosorted dataTable, instead of single one, holding currently selected sorted columns of all tables.
Actually, my project is in early stages, so I'm sure that this issue will be fixed before it's release :)

Thank you very much for fast response!

Regards,
Alexander.

> 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
>         Assigned To: Catalin Kormos
>
> 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

        

[jira] Commented: (TOMAHAWK-550) Sort property of sortable table is null when sort column is set.

Posted by "Alexander Slobodyanik (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/TOMAHAWK-550?page=comments#action_12421845 ] 
            
Alexander Slobodyanik commented on TOMAHAWK-550:
------------------------------------------------

Hi,
the use case is allowing user to select preffered sorting (i.e. sort column and sort ascending properties) on page once and then have it stored until session expires, without need to resort table every time he returns to this page.

Currently, I have such table:

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

where userBean is in request scope, while sortColumns and sortDirections beans - is session scope.
This works fine at first page access (sortColumn is null, sortProperty is defined by defaultSorted attribute of column), as well as during resorts and other actions on this page, until current view is not removed from server session - i.e., user navigates to another page. And, after returning to this page, sortColumn already not-null, and sortProperty is not set. This is part of log in that case:

<html.ext.HtmlDataTable id="_idJsp21" ... sortAscending="#{sortDirections.users}" sortColumn="#{sortColumns.users}" sortColumnIndex="0" sortProperty="NULL" sortable="false" ...>

I think, I can attach simple test WAR file, showing up my problem, if it will help. Currently, I've wrote extension of HtmlDataTable, with only overriden method  - protected DataModel createDataModel(), which gives desired behavior, though I don't think that this is a general fix. Please, let me know, if attaching it will help.

Thanks in advance,
Alexander.

> 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

        

[jira] Commented: (TOMAHAWK-550) Sort property of sortable table is null when sort column is set.

Posted by "Catalin Kormos (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/TOMAHAWK-550?page=comments#action_12436147 ] 
            
Catalin Kormos commented on TOMAHAWK-550:
-----------------------------------------

Hi Martin,

Sorry, it's not yet fixed.

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
>         Assigned To: Catalin Kormos
>
> 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

        

[jira] Commented: (TOMAHAWK-550) Sort property of sortable table is null when sort column is set.

Posted by "Catalin Kormos (JIRA)" <de...@myfaces.apache.org>.
    [ 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

        

[jira] Commented: (TOMAHAWK-550) Sort property of sortable table is null when sort column is set.

Posted by "Catalin Kormos (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/TOMAHAWK-550?page=comments#action_12421864 ] 
            
Catalin Kormos commented on TOMAHAWK-550:
-----------------------------------------

Ok, thanks for the details. The problem is that setting the sortColumn on the dataTable doesn't change the sortPropery to the corresponding value. I can suggest another workarround for now and see how this could be actualy resolved a little bit later. The workarround involves using the "defaultSorted" attribute from <t:column>. You could bind his value into a Map that is in session scope, something like the following:

<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:commandSortHeader>
                </f:facet>
                <h:outputText value="#{user.name}" styleClass="#{disablableStyles[user.disabled]}"/>
        </t:column> 
       ....(more columns here) 

sortColumns.settings['name'], sortColumns in session scope that has a Map field (settings) which holds pairs of column names and true/false values. Well, the Map would need to be a custom map which allows only one column name to have a value of true. I didn't actualy test this, but it should work, if not, it will help if you attach a simple war file for testing.

HTH,
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

        

[jira] Commented: (TOMAHAWK-550) Sort property of sortable table is null when sort column is set.

Posted by "Catalin Kormos (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/TOMAHAWK-550?page=comments#action_12421867 ] 
            
Catalin Kormos commented on TOMAHAWK-550:
-----------------------------------------

Well, on a second thought, this won't work cause defaultSorted doesn't sets back the value on the value binding, although this can be easily resolved if you can use the latest version from the SVN, can you?. I'll commit a change for this to work.

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