ICEfaces
  1. ICEfaces
  2. ICE-7336

ICEfaces interpretation of the sort criteria value expression for ace:dataTable

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1-Beta
    • Fix Version/s: 2.1-Beta2, 3.0
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      ICEfaces 2.1 BETA, IE, Chrome, Firefox
    • Assignee Priority:
      P2
    • Affects:
      Documentation (User Guide, Ref. Guide, etc.)

      Description

      Summary:
      I'd like to suggest that the sortBy attribute be changed so that it interprets the provided value expression. The resulting value should be a property that both the lazy and non-lazy mechanisms can use to find the property to use in the sorting. Either that or a new attribute that would lets us define what property name should be put in the SortCriteria.

      Problem description:
      I need to use c:forEach to create ace:columns because my columns are defined using metadata. I'm also using a LazyDataModel and implemented the load method which receives sort criteria and filter. However, I cannot use the sortBy and filterBy attributes because of the way these attributes are processed by ICEfaces. ICEfaces interprets the actual expression string to determine what property to sort on. The sort criteria is then filled with the second part of the expression (#{something.someproperty} becomes "someproperty" in the load method). It is therefore not possible, in a c:forEach loop, to change the value of the sortBy attribute since the expression is never interpreted which diverges from what the user would expect.

      <c:forEach items="#{bean.columns}" var="col">
      <ace:column rendered="#{col.visible}" sortBy="#{col.sortable?col.property:null}">
      ...
      </ace:column>
      </c:forEach>

      sortBy="#{col.sortProperty}" would also not work because for all columns, I would receive "sortProperty" in the sortCriteria and not the actual value #{col.sortProperty} should resolve to.

      NOTE:
      //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
      Q: Have you tried to invoke method in the value expression?
      Example:
      Such us: sortBy="#{myBean.determineSortingCriteria(col.parameterToAnalyze)}"
      In MyBean you would declare:
      public <requiredReturnType> determineSortingCriteria(<typeOfParameter> parameterToAnalyze)
      {
      ....//custom logic goes here
      return <requiredReturnType> value;
      }
      //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
      A: This would not work; ICEfaces does not interpret the value expression, it looks at the string within the expression to determine what to put in the sortCriteria. It doesn't matter whether the expression refers to a real bean or not, ICEfaces only takes the last part and fills the SortCriteria with it: #{dummyBeanThatDoesntexist.someProperty}. SortCriteria gets filled with "someProperty".

        Activity

          People

          • Assignee:
            Nils Lundquist
            Reporter:
            Evgheni Sadovoi
          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: