Uploaded image for project: 'Service Packs and Hot Fixes'
  1. Service Packs and Hot Fixes
  2. MNT-1129

Sorting problem for boolean type property in browse view (JSF)

    Details

    • Type: Service Pack Request
    • Status: Closed (View Workflow)
    • Resolution: Fixed
    • Affects Version/s: 2.2.6
    • Fix Version/s: 2.2.8
    • Component/s: Alfresco Explorer
    • Labels:
      None
    • Environment:
      Tomcat/MySQL/Windows
    • Bug Priority:
      Category 2
    • ACT Numbers:

      7192

    • Testcase ID:
      Hide

      Rep-759

      Show
      Rep-759

      Description

      Problem
      ------------
      Strange behaviour with sorting a boolean column in list view in JSF - this could be a configuration issue or a bug with JSF.

      Details
      ----------
      When configuring the list view in JSF to include a boolean property and trying to sort by this boolean value it is observed that you have to click twice on the column header for the sorting to work. Initial sort -order seems to work OK on the boolean column but clicking on the header to change the sort order makes the order appear random, clicking on the header column again re-sorts correctly.
      This problem has been reported by a customer and since replicated in-house.

      Set up a rudimentary repro by altering the existent contentModel and adding a High Priority property to the cm:auditable aspect, this is set as follows following the d:boolean data type:
      <property name="cm:highpriority">
      <title>High Priority</title>
      <type>d:boolean</type>
      <index enabled="true">
      <atomic>true</atomic>
      <stored>false</stored>
      <tokenised>both</tokenised>
      </index>
      Altering the web-client-config-custom.xml allows the boolean value to set in the GUI when adding/modifying conent.

      Next I altered the browse.jsp to include the High Priority column for content listings, see below:

      <%-- Urgent column for custom view modes --%>
      <a:column id="colHighPriority" style="text-align:left" rendered="#

      {BrowseBean.browseViewMode == 'details'}

      ">
      <f:facet name="header">
      <a:sortLink id="colHighPriority-sort" label="High Priority" value="cm:highpriority" styleClass="header" mode="case-insensitive" />
      </f:facet>
      <h:outputText id="colHighPriority-txt" value="#

      {r['cm:highpriority'] ? 'Yes' : 'No'}

      " >
      <a:booleanEvaluator value="#

      {r['cm:highpriority']}

      "></a: booleanEvaluator>
      </h:outputText>
      </a:column>

      So far this displays fine, the listings show this additional column.

      Next I edit the content list in the browse.jsp to include the sort definition.

      <a:richList id="contentRichList" binding="#

      {BrowseBean.contentRichList}

      " viewMode="#

      {BrowseBean.browseViewMode}

      " pageSize="#

      {BrowseBean.pageSizeContent}

      "
      styleClass="recordSet" headerStyleClass="recordSetHeader" rowStyleClass="recordSetRow" altRowStyleClass="recordSetRowAlt" width="100%"
      value="#

      {BrowseBean.content}

      " var="r" initialSortColumn="cm:highpriority" initialSortDescending="true">

      • and inject the RichListRenderer into the Views via the web-client-config-custom.xml:

      <config evaluator="string-compare" condition="Views">
      <!-- the views available in the client -->
      <views>
      <view-impl>
      org.alfresco.web.ui.common.renderer.data.RichListRenderer $DetailsViewRenderer
      </view-impl>
      <!-- default values for the views available in the client -->
      <view-defaults>
      <browse>
      <!-- allowable values: list|details|icons -->
      <view>details</view>
      <page-size>
      <list>10</list>
      <details>10</details>
      <icons>9</icons>
      </page-size>
      </browse>
      </view-defaults>
      <view-impl>
      org.alfresco.web.ui.common.renderer.data.RichListRenderer $ListViewRenderer
      </view-impl>
      </views>
      </config>

      Observations
      ------------------
      The content listing does appear to initially list correctly by the boolean property column, however if you click the column header to change the order round, the order appears to go random (probably sorting by another order), when you click the column header again it sorts again correctly.

      Steps for replication
      ---------------------------
      Install 3.1.1e
      Put attached files into the following locations of the clean 3.1.1 instance:
      contentModel.xml - this has been modified slightly to include a boolean apsect for testing. Overwrite the existing contentModel.xml in 'alfresco\WEB-INF\classes\alfresco\model'.
      web-client-config-custom.xml - overwrite the existing web-client-config-custom.xml in 'shared\classes\alfresco\extension'.
      browse.jsp - overwrite the existing browse.jsp in 'webapps\alfresco\jsp\browse'

      Start Alfresco and create a test space.
      In this space add some content, make some high priority and others not.
      Refresh the page with the content listing and it should sort automatically by the column 'High Priority'
      Now click the header 'High Priority', notice that it takes two clicks to re-sort correctly each time.

      Additional Info
      --------------------
      Customer's environment is 2.2.3e, though this problem was observed initially on 2.2.0e
      Reproduced in-house on 3.1.1e
      Problem is not seen on non-boolean properties, these sort correctly on single click.

      Workaround
      -----------------
      None, customer is using a different data type for the sorting (d:date).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                closedbugs Closed Bugs
                Reporter:
                astrachan Alex Strachan
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: