Announcement

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

    cant update eventStyle on timeline event

    I am using:
    SmartClient Version: v10.0p_2015-06-25/Pro Deployment (built 2015-06-25)


    I want to restyle a timeline event when its selected.

    I'm trying to change the event style in the timeline onEventClick callback method.

    code looks like ( typed in by hand )

    public void onEventClick( new EventClickHandler( CalendarEventClick event) {

    CalenderEvent ca = event.getEvent();

    // I tried all the following (one at a time) to update the event styling
    ca,setBackgroundColor("blue"); // THIS WORKED - event background turns blue
    ca.setTextColor("blue"); // DID NOT WORK, event displayed text color unchanged
    ca.setStyleName("one of the event styles I use when I create events - so I know it works"); // DID NOT WORK NO CHANGE

    timeline.updateCalendarEvent(event.getEvent(), ca, null);

    }


    Any suggestions would be appreciated.

    Thanks in Advance

    #2
    10.0 doesn't support eventCanvas selection. In later versions, you can setCanSelectEvents(true).

    Comment


      #3
      Thanks ....

      Comment


        #4
        Should that work in 10.1 ??

        Comment


          #5
          The feature is present in that version, yes, but it turns out that canSelectEvents is not actually public in any version.

          If you want to test out whether this setting would do what you're after, you should be able to test it via calendar.setAttribute("canSelectEvents", true) - if it does what you need, we can look at exposing it.

          Comment


            #6
            Thanks for the info - I added

            setAttribute("canSelectEvents",true,false) to the time line when I created it.
            however setting that appears to have no effect when clicking | double clicking on an event ( sublane event to be exact )

            I also tried adding
            setSelectedCellStyle("myStyle,true,false);
            without effect.

            Any ideas why this is not working

            Thanks

            Comment


              #7
              setSelectedCellStyle() is unrelated to CalendarEvents, and cell-selection is unsupported in Timelines anyway - if you want to style cells, you can use DateStyleCustomizer and DateCSSTextCustomizer as of 5.1 - these affect whichever cells represent the passed dates in the passed CalendarView.

              As for eventCanvas-selection - the attempts you made in onEventClick() may appear to work, depending on whether or not the event actually changes - but updateCalendarEvent() is a data-bound method - it permanently updates the calendarEvent record, so you'd need to keep track of which canvas/event you consider to be "selected", so you can unselect (unstyle) it again when some other canvas becomes selected, for example.

              However, the canvas would *not* actually be selected (canSelect is false).

              When set to true, the (currently internal) canSelectEvents API enables eventCanvas selection, effectively meaning that eventCanvases are added to the tab-order - you can select them with the mouse, tab between them or use Enter to edit or Delete to remove them. Visually, the selected canvas uses *Selected CSS classes (more obvious canvas border by default) and shows static rolloverControls (resizers and close-button).

              You can test the feature with this code below, but note that if we *do* consider exposing canSelectEvents, it won't be ported back to 5.0, since it's a new feature and that's quite an old branch - you'd most likely need to upgrade to 6.0 because the feature would remain internal and unsupported in older versions:

              Code:
                      JavaScriptObject jso = JSOHelper.createObject();
                      JSOHelper.setAttribute(jso, "canSelectEvents", true);
                      Timeline timeline = new Timeline(jso);
              Last edited by Isomorphic; 14 Nov 2016, 22:30.

              Comment


                #8
                Well thanks for all the good info on this ! I wouldn't keep beating on this but I'm making extensive use of the timeline and would really like to get a workable solution for cell selection styling.

                The code you provided helped. When I select a event via mouse click it is still not styled to indicate selection; however at that point tab order selection works. That is after mouse click a tab causes the next cell in the list to be selected AND styled.

                Any additional assistance would be appreciated

                Comment


                  #9
                  The attribute we mentioned, canSelectEvents, allows you to select *eventCanvas* widgets in the timeline, not cells themselves.

                  As we've already noted, cell-selection is unsupported in Timelines - if you're seeing what looks like cell-selection happening, that's a bug.

                  Which version are you now using that you're seeing that effect in? If you intend to be making extensive use of Timelines, as you say, then you will certainly want to update - to 6.0 ideally. Otherwise, you won't have access to enhancements and features added in the last 2 years and, while fixes for serious bugs will usually be patched into those older builds, new features will not be, and nor will fixes specific to major browser versions more modern than the release you're using.

                  Given that cell-selection is not something we intentionally support, even in 6.1, it's not something you can implement. However, it's not at all clear to us why you might want to select the cells in a timeline, so it's possible we misunderstand what you actually want to do.

                  In that case, please provide a standalone, minimal test-case that show's your issue - include steps to reproduce, and let us know what you want versus what you're getting.
                  Last edited by Isomorphic; 15 Nov 2016, 20:48.

                  Comment


                    #10
                    Thanks for your continued input on this. Given your input I think the best ( most flexible approach) I can find is to use the event name field to control the styling of the cell. This seems pretty flexible and allows me to apply whatever css styling I choose. So in my case when a cell is selected (clickHandler event) I can simply modify the event name so that the outer borders of the cell are highlighted. Of course I have to keep track of selection but that's trivial. It also gives me fine grained control of all cell/event style aspects.

                    I'm using the timeline to display some high level status stuff. On selection of a event a bunch of detailed information is displayed. The layout is similar to your split pane. I want to highlight the selected cell, then display associated list and details information on separate panes.

                    I appreciate the test case offer however because of our development environment its really not practical to provide test cases. ( Which I realize makes it hard for you to help ).

                    I think styling the call via the event name solves my issues

                    Agree we should update to 6.0.

                    thanks again for the solid support



                    Comment

                    Working...
                    X