Announcement

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

    ListGrid Date Issue

    Hi,

    Version: Power Edition 2.3 / 27.08.2010

    In a datasource I have a field with the type “datetime”. In a ListGrid I want to show the format “DD.MM.YYYY”.

    Code:
    ListGridField logValidTo = new ListGridField(GeneratedFieldConsts.F_LOG_VALID_TO);
    logValidTo.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATE);
    Problem:
    In the ListGrid ist the format “DD/MM/YYYY”. If I use the type “date” in the datasource the format is perfect out of the box (“DD.MM.YYYY”). Is there a simple way to change the date separator for a ListGridField?

    Regards
    Chris

    #2
    You can set the default system-wide separator with DateUtil.setDefaultDateSeparator().

    Comment


      #3
      Thank's,

      since which build is that function implemented? Rather which build is recommended?

      I use the Power Edition 2.3.build.2010-08-27 and that function isn't covered.


      Regards
      Chris

      Comment


        #4
        Whoops, you are correct that it was missing. It has now been added and will appear in the next nightly, or you could add a method to call it via JSNI now:

        Code:
            public static native void setDefaultDateSeparator(String separator) /*-{
                $wnd.isc.Date.setDefaultDateSeparator(separator);
            }-*/;

        Comment


          #5
          I tried nightly build 11.10.2010 of the Power Edition. During startup I got the following exception:

          Code:
          09:08:32.305 [ERROR] [frontend] Failed to create an instance of 'de.sdom.frontend.client.Frontend' via deferred binding 
          com.google.gwt.core.client.JavaScriptException: (TypeError): $wnd.isc.Date.setDefaultDateSeparator is not a function
           fileName: http://127.0.0.1:8080
           lineNumber: 13
           stack: (".")@http://127.0.0.1:8080:13
          connect("http://127.0.0.1:8080/Frontend.html?gwt.codesvr=127.0.0.1:9997","rQNld:SeUA$8@{CI","127.0.0.1:9997","frontend","2.0")@:0
          ((void 0),"frontend","http://127.0.0.1:8080/frontend/")@http://127.0.0.1:8080/frontend/hosted.html?frontend:264
          z()@http://127.0.0.1:8080/frontend/frontend.nocache.js:2
          (5)@http://127.0.0.1:8080/frontend/frontend.nocache.js:11
              at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:195)
              at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120)
              at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507)
              at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:284)
              at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
              at com.smartgwt.client.util.DateUtil.setDefaultDateSeparator(DateUtil.java)
              at de.tmobile.sdom.frontend.client.Frontend.<init>(Frontend.java:74)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
              at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
              at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:422)
              at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:361)
              at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:185)
              at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:380)
              at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
              at java.lang.Thread.run(Thread.java:619)
          More information required?

          Comment


            #6
            Sorry about that - a bug in the implementation.
            This is now resolved - try the next nightly build (October 14 2010) and let us know if you continue to see problems

            Comment


              #7
              I tried the current nightly (17. October) and got the following exception in every Form with a DateItem:

              Code:
              09:56:25.790 [ERROR] [frontend] Uncaught exception escaped
              com.google.gwt.core.client.JavaScriptException: (TypeError): Date.getDefaultDateSeparator is not a function
               fileName: http://127.0.0.1:8080/frontend/sc/modules/ISC_Forms.js
               lineNumber: 2240
               stack: isc_DateItem__getDefaultDateSeparator()@http://127.0.0.1:8080/frontend/sc/modules/ISC_Forms.js:2240
              isc_DateItem_setItems([object Array])@http://127.0.0.1:8080/frontend/sc/modules/ISC_Forms.js:2244
              isc_ContainerItem_init([object Object],(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0))@http://127.0.0.1:8080/frontend/sc/modules/ISC_Forms.js:1641
              isc_c_Class_invokeSuper(null,"init")@http://127.0.0.1:8080/frontend/sc/modules/ISC_Core.js:298
              isc_c_Class_Super("init",[object Object])@http://127.0.0.1:8080/frontend/sc/modules/ISC_Core.js:290
              isc_DateItem_init([object Object],(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0))@http://127.0.0.1:8080/frontend/sc/modules/ISC_Forms.js:2238
              isc_Class_completeCreation([object Object])@http://127.0.0.1:8080/frontend/sc/modules/ISC_Core.js:357
              isc_DynamicForm_createItem([object Object],"date")@http://127.0.0.1:8080/frontend/sc/modules/ISC_Forms.js:299
              isc_DynamicForm__addItems([object Array],null,true,true)@http://127.0.0.1:8080/frontend/sc/modules/ISC_Forms.js:286
              isc_DynamicForm_setItems([object Array],true)@http://127.0.0.1:8080/frontend/sc/modules/ISC_Forms.js:275
              isc_DynamicForm_initWidget([object Object],(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0))@http://127.0.0.1:8080/frontend/sc/modules/ISC_Forms.js:262
              isc_Canvas_init([object Object],(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0))@http://127.0.0.1:8080/frontend/sc/modules/ISC_Core.js:1949
              isc_Class_completeCreation([object Object],(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0))@http://127.0.0.1:8080/frontend/sc/modules/ISC_Core.js:357
              isc_c_Class_create([object Object])@http://127.0.0.1:8080/frontend/sc/modules/ISC_Core.js:227
              ()@http://127.0.0.1:8080:179
              @:0
              ([object GWTJavaObject],4718644,[object GWTJavaObject])@http://127.0.0.1:8080/frontend/hosted.html?frontend:56
              ([object Object],[object Object],[object Object],1)@http://127.0.0.1:8080:30
              ((function () {var param = {target: arguments[0], item: arguments[1], menu: arguments[2], colNum: arguments[3]};var event = __gwt_makeJavaInvoke(1)(null, 11599901, param);__gwt_makeJavaInvoke(1)(selfJ, 4718644, event);}),[object Object],[object Object])@http://127.0.0.1:8080:66
              @:0
              (null,27,(function () {var param = {target: arguments[0], item: arguments[1], menu: arguments[2], colNum: arguments[3]};var event = __gwt_makeJavaInvoke(1)(null, 11599901, param);__gwt_makeJavaInvoke(1)(selfJ, 4718644, event);}),[object Object],[object Object])@http://127.0.0.1:8080/frontend/hosted.html?frontend:56
              ([object Object],[object Object],[object Object],1)@http://127.0.0.1:8080:3
              isc_Menu_selectMenuItem([object Object],1)@http://127.0.0.1:8080/frontend/sc/modules/ISC_Grids.js:2947
              isc_Menu_rowClick([object Object],0,1)@http://127.0.0.1:8080/frontend/sc/modules/ISC_Grids.js:2939
              anonymous([object Object],0,1)@http://127.0.0.1:8080/frontend/sc/modules/ISC_Grids.js:905
              isc_GridRenderer__rowClick(0,1)@http://127.0.0.1:8080/frontend/sc/modules/ISC_Grids.js:759
              isc_GridRenderer_click([object Object],(void 0))@http://127.0.0.1:8080/frontend/sc/modules/ISC_Grids.js:756
              isc_Canvas_handleClick([object Object],(void 0))@http://127.0.0.1:8080/frontend/sc/modules/ISC_Core.js:3059
              isc_c_EventHandler_bubbleEvent([object Object],"click")@http://127.0.0.1:8080/frontend/sc/modules/ISC_Core.js:1546
              isc_c_EventHandler_handleClick([object Object])@http://127.0.0.1:8080/frontend/sc/modules/ISC_Core.js:1397
              isc_c_EventHandler__handleMouseUp([object MouseEvent],(void 0))@http://127.0.0.1:8080/frontend/sc/modules/ISC_Core.js:1384
              isc_c_EventHandler_handleMouseUp([object MouseEvent])@http://127.0.0.1:8080/frontend/sc/modules/ISC_Core.js:1375
              isc_c_EventHandler_dispatch(isc_c_EventHandler_handleMouseUp,[object MouseEvent])@http://127.0.0.1:8080/frontend/sc/modules/ISC_Core.js:1609
              anonymous([object MouseEvent])@http://127.0.0.1:8080/frontend/sc/modules/ISC_Core.js:60
                  at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:195)
                  at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120)
                  at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507)
                  at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:264)
                  at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
                  at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
                  at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:188)
                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                  at java.lang.reflect.Method.invoke(Method.java:597)
                  at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
                  at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
                  at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
                  at com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:1669)
                  at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401)
                  at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
              Last edited by chris1978; 18 Oct 2010, 00:09.

              Comment


                #8
                We've tested this against the build you mention without seeing this problem.
                Can you check for stale code (try running GWT Compile on your project, or possibly clearing your browser cache and see if you continue to see the bug).
                If you do - post a test case

                Thanks

                Comment


                  #9
                  I narrowed down the problem. The exception occurs if I use the option "useMask=true". Without the option it's working fine.

                  Code:
                  package de.sdom.frontend.client.widgets;
                  
                  import com.google.gwt.core.client.JavaScriptObject;
                  import com.smartgwt.client.types.DateDisplayFormat;
                  import com.smartgwt.client.widgets.form.fields.DateItem;
                  
                  public class StyledDateItem extends DateItem {
                  
                  	public StyledDateItem() {
                  		super();
                  		init();
                  	}
                  
                  	public StyledDateItem(JavaScriptObject jsObj) {
                  		super(jsObj);
                  		init();
                  	}
                  
                  	public StyledDateItem(String name) {
                  		super(name);
                  		init();
                  	}
                  
                  	public StyledDateItem(String name, String title) {
                  		super(name, title);
                  		init();
                  	}
                  
                  	private void init() {
                  		this.setUseTextField(true);
                  		this.setMaskDateSeparator(".");
                  		// this.setUseMask(true);
                  		this.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATE);
                  		this.setEnforceDate(true);
                  	}
                  
                  }

                  Comment


                    #10
                    Ahh - ok I see it.
                    Thanks for the test case. This is now fixed (and tested). The fix will be present in the next nightly. Let us know if this still happens for you after tonight's build (will be dated Oct 20)

                    Comment

                    Working...
                    X