Announcement

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

    Strange Calendar behaviour in SmartGWT 4.1

    Hi!

    I'm trying to migrate from SmartGWT 3.0 to 4.1. I migrated my code to 4.1, and found a strange behaviour in Calendar widget. I'd like to emphasize that my 3.0 code is in production and working normally, and I didn't change anything, just made a new project with 4.1 and deployed to the same environment.

    1) Handling background click
    I have a custom handler and a custom DynamicForm for adding new event.
    Code:
    addBackgroundClickHandler(new BackgroundClickHandler() {
    	@Override
    	public void onBackgroundClick(BackgroundClickEvent event) {
    		event.cancel();
    		// show DynamicForm
    		...
    	}
    });
    The difference in 4.1 is that my handler gets invoked after I click on the background, but NOT when I drag the mouse as I want a longer duration of my event, which was not the case in 3.0.

    How I can catch dragging in 4.1?

    2) Wrong times in startDate and endDate
    When I drag events or try to add/edit events, the CalendarEvent that I receive in my handler has wrong startDate and endDate!

    The dates I get have the right date and the wrong time: sometimes 1:00 a.m., sometimes 1:11 a.m., sometimes 1:22 a.m., but without any rule when specific value appears! Those datetimes totally confused me. I even tried to show the simplest Calendar class (from the showcase) and the behaviour is the same!


    Environment: SmartGWT 4.1 (v9.1p_2014-03-23/EVAL Deployment), GWT 2.3.0, Firefox 26, Ubuntu 12.04 64-bit

    #2
    1) There's a backgroundMouseUp event which fires when the mouse is released and the cell under the mouse has changed. We've just made that public - please retest with a build of 4.1 dated March 25 or later.

    2) This sounds like there is a mismatch between rowHeight and eventSnapGap - make sure the latter is either the same as the former, or some sensible percentage of it

    Comment


      #3
      Originally posted by Isomorphic View Post
      1) There's a backgroundMouseUp event which fires when the mouse is released and the cell under the mouse has changed. We've just made that public - please retest with a build of 4.1 dated March 25 or later.

      2) This sounds like there is a mismatch between rowHeight and eventSnapGap - make sure the latter is either the same as the former, or some sensible percentage of it
      1) Ok, I'll try that build.

      2) My values were: rowHeight = 40, eventSnapGap = 15.
      I've set both of them to 20, but the strange behaviour remained.

      Comment


        #4
        Can you show some code for point 2? Specifically, the code for whichever handler you mean in your comment "the CalendarEvent that I receive in my handler"...

        Also, please clarify this comment: "I even tried to show the simplest Calendar class (from the showcase) and the behaviour is the same!"

        We're not sure what you mean - can you point us at the example you mean and give steps to reproduce?

        Comment


          #5
          Originally posted by Isomorphic View Post
          Can you show some code for point 2? Specifically, the code for whichever handler you mean in your comment "the CalendarEvent that I receive in my handler"...

          Also, please clarify this comment: "I even tried to show the simplest Calendar class (from the showcase) and the behaviour is the same!"

          We're not sure what you mean - can you point us at the example you mean and give steps to reproduce?
          I understand that my description isn't precise enough. Tomorrow I'll try to prepare minimum code to reproduce the strange behaviour.

          Comment


            #6
            Originally posted by Isomorphic View Post
            Can you show some code for point 2? Specifically, the code for whichever handler you mean in your comment "the CalendarEvent that I receive in my handler"...

            Also, please clarify this comment: "I even tried to show the simplest Calendar class (from the showcase) and the behaviour is the same!"

            We're not sure what you mean - can you point us at the example you mean and give steps to reproduce?
            I managed to reproduce the strange behaviour. I took the "buildinds" sample and modified it. It appears when I include Croatian localization.

            1) BuiltInDS
            Code:
            public class BuiltInDS implements EntryPoint {
            
            	/**
            	 * This is the entry point method.
            	 */
            	public void onModuleLoad() {
            		DataSource eventDS = new DataSource();
            		DataSourceSequenceField eventIdField = new DataSourceSequenceField("eventId");
            		eventIdField.setPrimaryKey(true);
            
            		DataSourceTextField nameField = new DataSourceTextField("name");
            		DataSourceTextField descField = new DataSourceTextField("description");
            		DataSourceDateTimeField startDateField = new DataSourceDateTimeField("startDate");
            		DataSourceDateTimeField endDateField = new DataSourceDateTimeField("endDate");
            
            		eventDS.setFields(eventIdField, nameField, descField, startDateField, endDateField);
            		eventDS.setClientOnly(true);
            		eventDS.setTestData(CalendarData.getRecords());
            
            		Calendar calendar = new Calendar();
            		calendar.setDataSource(eventDS);
            		calendar.setUseAllDataSourceFields(false);
            		calendar.setAutoFetchData(true);
            		
            		calendar.addBackgroundClickHandler(new BackgroundClickHandler() {
            			@Override
            			public void onBackgroundClick(BackgroundClickEvent event) {
            				event.cancel();
            				
            				System.out.println("event.getStartDate() = " + event.getStartDate());
            				System.out.println("event.getEndDate() = " + event.getEndDate());
            			}
            		});
            
            
            		calendar.draw();
            	}
            }
            2) The CalendarData class from the showcase is added to the project as is.

            3) BuiltInDS.html
            Added
            Code:
            <html>
              <head>
                <meta http-equiv="content-type" content="text/html; charset=UTF-8">
                <!--  ADDED!   -->
                <meta name="gwt:property" content="locale=hr">
               .....
            4) BuiltInDS.gwt.xml
            Added
            Code:
            <module rename-to="builtinds">
                <inherits name='com.google.gwt.user.User'/>
            
                <!--  ADDED!   -->
                <inherits name="com.google.gwt.i18n.I18N"/>
            
                <inherits name="com.smartgwt.tools.SmartGwtTools"/>
                <inherits name="com.smartgwtee.tools.Tools"/>
                <inherits name="com.smartgwtee.SmartGwtEE"/>
                
                <!--  ADDED!   -->
                <extend-property name="locale" values="hr"/>
                <!--  ADDED!   -->
                <set-property-fallback name="locale" value="hr"/>
                
                <entry-point class='com.smartgwt.sample.client.BuiltInDS'/>
            </module>
            When I remove the added lines from BuiltInDS.html and BuiltInDS.gwt.xml, everything works as expected.

            Comment


              #7
              Originally posted by Isomorphic View Post
              1) There's a backgroundMouseUp event which fires when the mouse is released and the cell under the mouse has changed. We've just made that public - please retest with a build of 4.1 dated March 25 or later.
              This one works, thank you!

              Comment


                #8
                It seems that the bug with start and end times was solved. Thank you!

                Comment

                Working...
                X