Announcement

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

    Timeline customize event editor

    I am trying to customize the event editor for a timeline. So I did the following:

    Code:
    public class TestingModule implements EntryPoint {
    
        private int i = 0;
    
        public void onModuleLoad() {
    
            VLayout vlayout = new VLayout();
            final Timeline calendar = new Timeline();
            calendar.setHeight(451);
            calendar.setStartDate(new Date(112, 5, 2));
            calendar.setEndDate(new Date(112, 5, 22));
            calendar.setCanEditLane(true);
            calendar.setShowEventDescriptions(false);
    
            HeaderLevel[] headerLevels = new HeaderLevel[] { new HeaderLevel(TimeUnit.WEEK),
                    new HeaderLevel(TimeUnit.DAY) };
            calendar.setHeaderLevels(headerLevels);
            calendar.setLaneFields(new ListGridField[] { new ListGridField("title", "Developer", 120) });
            calendar.setLanes(TimelineLaneData.getRecords());
            calendar.setData(TimelineData.getRecords());
            calendar.setCanEditLane(false);
            calendar.setShowQuickEventDialog(false);
            
            calendar.setEventEditorCustomizer(new EventEditorCustomizer() {
    
                @Override
                public boolean showEventEditor(final CalendarEvent calendarEvent, Boolean isNewEvent) {
                    getCalendar().getEventDialog().hide();
                    SC.logWarn("Editing");
                    // Create window for editing event
                    return false;
                }
            });
    
            vlayout.addMember(calendar);
    
            vlayout.setWidth100();
            vlayout.setHeight100();
            vlayout.draw();
        }
    
    }
    Using smartgwt 6.0p power 13.08.16
    It is working, but the visual hint is not disappearing. So if the user cancels the creation of the event in my customized window, the visual hint is still there (just click anywhere in an editable cell):

    Click image for larger version

Name:	Bildschirmfoto 2016-08-21 um 15.49.42.png
Views:	39
Size:	11.2 KB
ID:	239799Click image for larger version

Name:	Bildschirmfoto 2016-08-21 um 15.49.48.png
Views:	38
Size:	5.5 KB
ID:	239800


    #2
    Your custom editor is expected to clear up after itself, but there was no public API that allowed you to clear the selection-canvas. We've just added cancelEditing(), which you can call from your Customizer, or as your custom editor closes, to remove the visible selection. Note that this is only necessary if your custom dialog is cancelled. If your dialog saves it's data, the selection-canvas will be removed automatically.

    Please retest with a build dated August 25 or later.

    Code:
    getCalendar().cancelEditing();

    Comment

    Working...
    X