Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-2752

A Grid doesn't sort if sorting column cointans a dot in the PropertyModel of the Grid. 

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 5.8.2
    • None
    • tapestry-core
    • None

    Description

      A Grid doesn't sort if the sorting column contains a dot in the PropertyModel of the Grid. 

      This BUG was introduced by fixing an issue TAP5-2689.

      This actual Code always returns an empty list for columns with a dot within the property name:

      if ((paginationModel == null || paginationModel.getSortColumnId() == null)
      || !(dataModel.getPropertyNames().contains(TapestryInternalUtils.extractIdFromPropertyExpression(paginationModel.getSortColumnId()))))
      {return Collections.emptyList();}
      

      The correct code was something like that:

      if (paginationModel == null || paginationModel.getSortColumnId() == null
      || dataModel.getPropertyNames().stream().noneMatch(x -> TapestryInternalUtils.extractIdFromPropertyExpression(x).equals(paginationModel.getSortColumnId())))
      {
      	return Collections.emptyList();
      }
      
      public class A
      {
      public B b;
      }
      
      public class B
      {
      public name;
      }
      
      public class C
      {
      public BeanModel<A> getGridModel()
      	{
      		final BeanModel<A> model = beanModelSource.createDisplayModel(A.class, messages);
      		
      		model.include();
      		model.add("b.name").sortable(true);
      return model;
      }
      }
      

      Sorting on column "name" is not working because the property name includes a dot.

      Attachments

        Issue Links

          Activity

            People

              ben-ng Ben Weidig
              lrein LRein
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: