Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Timeline selected Lane Style

    Hello dear developers,
    I have been searching for a long time how to make styles visible for a selected Lane.
    As a result, I came to this decision...
    Code:
            ListGrid tasksLineProps = new ListGrid();
            tasksLineProps.setSelectionType(SelectionStyle.SINGLE);
            tasksLineProps.setHoverWrap(false);
            tasksLineProps.setHoverAutoFitWidth(false);
            tasksLineProps.setShowGroupTitleInFrozenBody(false);
            tasksLineProps.setShowSelectedStyle(true);
            tasksLineProps.addSelectionChangedHandler(new SelectionChangedHandler() {
                @Override
                public void onSelectionChanged(SelectionEvent event) {
                    ListGridRecord page = event.getRecord();
                    CalendarView calendarView = (CalendarView) event.getFiringCanvas();
                    String style = calendarView.getAttribute("labelColumnBaseStyle");
                    if(event.getState()) {
                        style += "Selected";
                    }
                    page.setAttribute("styleName", style);
                    calendarView.redraw();
                }
            });
    .....
    .....
            tasksLine = new Timeline();
            tasksLine.setAutoChildProperties("timelineView", tasksLineProps);
            tasksLine.setHeight("100%");
            tasksLine.setHeaderLevels(headerLevels);
            tasksLine.setShowComplexFields(true);
            tasksLine.setShowQuickEventDialog(false);
            tasksLine.setShowEventDescriptions(false);
            tasksLine.setShowLaneFieldHovers(true);
            tasksLine.setCanEditLane(false);
            tasksLine.setLaneFields(pageTitleField, pageGroupField);
            tasksLine.setCanGroupLanes(true);
            tasksLine.setCanSelectEvents(true);
            tasksLine.setStartDate(currentDate);
            tasksLine.setCanRemoveEvents(false);
            tasksLine.setNameField(CONSTANT.TITLE);
            tasksLine.setDescriptionField(CONSTANT.HTMLTEXT);
            tasksLine.setStartDateField(CONSTANT.BEGINNING_DATE);
            tasksLine.setEndDateField(CONSTANT.DUE_DATE);
            tasksLine.setHideUnusedLanes(false);
            tasksLine.setResolution(headerLevels, TimeUnit.MONTH, 1, null);
            tasksLine.setLanes(tasksLanes);
            tasksLine.getSelectedView().setProperty("groupRowHeight", GROUP_ROW_HEIGHT);
    Click image for larger version

Name:	TimeLine1.jpg
Views:	43
Size:	60.7 KB
ID:	261582
    But there was one problem. I can't assign the "selected" style to a Lane item in the Lanes list.
    Could you tell me how to do this?

    #2
    You won't be able to make this work because of the way internal styling code is structured in Timelines. We're looking into the best way to address it and will update here when we have more information.

    Comment


      #3
      You didn't mention your version or skin, but we've reworked some framework code and added some skin styles to 12.1 and later versions, for builds dated April 2 and later.

      In those builds, you should find that normal ListGrid-type styling techniques will work as you expect. But you won't need them because selecting will just work, as it would in other types of grids, via the .calendar and .labelColumn classes.

      We'll port these changes to 12.0 in the coming days, but note that they won't be ported to any earlier versions.

      Comment


        #4
        Thanks a lot. Everything works just fine.

        Comment


          #5
          Unfortunately, the new version no longer displays Hover for Lane.
          Has anything changed in the settings for displaying Hover?

          Comment


            #6
            Old versiov v12.1d_2019-12-11
            New version v12.1p_2020-04-03

            Comment


              #7
              Yes, we reworked how Timeline hovers work at the same time as replacing the custom cell-styling mechanism, because hovers were similarly customized and more expensive than necessary.

              The problem here is just that laneField hovers are also expecting cellHovers to be turned on. We'll revisit and update here when that's been fixed.

              In the meantime, calling setShowCellHovers(true) will fix it for now - you'll just see hovers for all cells, not just laneFields.

              Comment

              Working...
              X