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

        Hide
        Nils Lundquist added a comment -

        This faux-el has needed a lot of revision and we haven't had the time to revise it yet.

        In the meantime,
        Do you need to use c:forEach?
        Do you need totally dynamic sets of columns?
        If not, why not have predefined sets of columns you swap between using a ui:include?

        Show
        Nils Lundquist added a comment - This faux-el has needed a lot of revision and we haven't had the time to revise it yet. In the meantime, Do you need to use c:forEach? Do you need totally dynamic sets of columns? If not, why not have predefined sets of columns you swap between using a ui:include?
        Hide
        Pierre Asselin added a comment -

        I do need c:forEach because I'm told ace:columns isn't ready and it doesn't look like it would support sortBy from day one anyway. It would be helpful if ace:columns could be part of 2.1.
        This is a part of a composite component I'm building so I cannot know all the possible column sets in advance. It needs to adapt to possibly changing metadata. The only alternative I see would be for me to implement my own sorting component that I would use in the column header. I'd then need to ignore the sortCriteria sent to the LazyDataModel.load method and inject my own in some way. Not ideal of course, because I would need to build my own thing that would not be compatible with the eventual resolution of this problem. So I'd need to know as soon as possible if this will be fixed in 2.1 so that I can evaluate the alternatives.

        Thanks!

        Show
        Pierre Asselin added a comment - I do need c:forEach because I'm told ace:columns isn't ready and it doesn't look like it would support sortBy from day one anyway. It would be helpful if ace:columns could be part of 2.1. This is a part of a composite component I'm building so I cannot know all the possible column sets in advance. It needs to adapt to possibly changing metadata. The only alternative I see would be for me to implement my own sorting component that I would use in the column header. I'd then need to ignore the sortCriteria sent to the LazyDataModel.load method and inject my own in some way. Not ideal of course, because I would need to build my own thing that would not be compatible with the eventual resolution of this problem. So I'd need to know as soon as possible if this will be fixed in 2.1 so that I can evaluate the alternatives. Thanks!
        Hide
        Nils Lundquist added a comment -

        Fixed in r26087

        Show
        Nils Lundquist added a comment - Fixed in r26087
        Hide
        Ladislav Gatial added a comment -

        hi, I wanted to use this dynamic columns with the c:forEach but it didn't work.
        I tryed to find your changes in the svn (r26087) but without success.
        I think this bug is related to ICE-8378. I also attached a symple prototype where you can still see the error mentioned here.
        I really need this feature, to get working can you please help me with that?
        thanx

        Show
        Ladislav Gatial added a comment - hi, I wanted to use this dynamic columns with the c:forEach but it didn't work. I tryed to find your changes in the svn (r26087) but without success. I think this bug is related to ICE-8378 . I also attached a symple prototype where you can still see the error mentioned here. I really need this feature, to get working can you please help me with that? thanx
        Hide
        Nils Lundquist added a comment -

        Please post your concerns in the forum before posting in several, quite possibly unrelated JIRAs.

        Show
        Nils Lundquist added a comment - Please post your concerns in the forum before posting in several, quite possibly unrelated JIRAs.
        Hide
        Ladislav Gatial added a comment -

        OK, I am sorry for the inconvenience. Here Is the forum topic.

        Show
        Ladislav Gatial added a comment - OK, I am sorry for the inconvenience. Here Is the forum topic.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: