powerparin / gwt-ext

Automatically exported from code.google.com/p/gwt-ext
0 stars 0 forks source link

Problems with firefox4: $wnd.Date.format is not a function #527

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi, I've and old application with gwt-ext, and migrating is very impossible.
I've test it to firefox beta10, and I can't solved problems with dates.
I'm doing something wrong, I need your help.

Original issue reported on code.google.com by matienza...@gmail.com on 29 Jan 2011 at 9:03

GoogleCodeExporter commented 8 years ago
Is there any news about this important problem?

Original comment by magnus12...@gmail.com on 23 Mar 2011 at 7:55

GoogleCodeExporter commented 8 years ago
Possibly related:
- http://forums.smartclient.com/showthread.php?t=15947
- https://bugs.webkit.org/show_bug.cgi?id=17250

Original comment by matthewl...@gmail.com on 25 Mar 2011 at 4:52

GoogleCodeExporter commented 8 years ago
Fix found! You'll need to add the following Javascript function to your HTML 
page:

Ext.newDate = function() {
    return new Date();
};

and then make the following modification to GWT-Ext's DateField class (I did so 
by overriding it so I wouldn't have to re-compile GWT-Ext; see attached):

    private native void setTime(JavaScriptObject df, double time)/*-{
        // doing the following instead of df.setValue(new $wnd.Date(time)); due to a Firefox 4/webkit bug
        // See http://code.google.com/p/gwt-ext/issues/detail?id=527 and https://bugs.webkit.org/show_bug.cgi?id=17250 for more info
        var dateJS = $wnd.Ext.newDate();
        dateJS.setTime(time);
        df.setValue(dateJS);
    }-*/;

Original comment by matthewl...@gmail.com on 25 Mar 2011 at 7:04

Attachments:

GoogleCodeExporter commented 8 years ago
Bug reported to Mozilla: https://bugzilla.mozilla.org/show_bug.cgi?id=645130

Original comment by matthewl...@gmail.com on 25 Mar 2011 at 7:38

GoogleCodeExporter commented 8 years ago
It seems it does not solve the .format function problem

Original comment by magnus12...@gmail.com on 28 Mar 2011 at 1:53

GoogleCodeExporter commented 8 years ago
DateUtil.java in gwt-ext:

    public static native String format(Date date, String format) /*-{
        if(date == null) return "";
        var millis = @com.gwtext.client.util.DateUtil::getTime(Ljava/util/Date;)(date);

        return new $wnd.Date(millis).format(format).toString();

    }-*/;

The following line throws the same exception:
        return new $wnd.Date(millis).format(format).toString();

Original comment by magnus12...@gmail.com on 28 Mar 2011 at 1:57

GoogleCodeExporter commented 8 years ago
Makes sense that this problem exists in multiple areas. You should be able to 
apply basically the same fix as I did to the DateField class; try changing

return new $wnd.Date(millis).format(format).toString();

to

var dateJS = $wnd.Ext.newDate();
dateJS.setTime(millis);
return dateJS.format(format).toString();

Original comment by matthewl...@gmail.com on 28 Mar 2011 at 3:28

GoogleCodeExporter commented 8 years ago
Using the suggestions from this thread I've created a patched version of the 
gwt-ext library (in attachment).
You need also to modify you html page adding this code:

    <script type="text/javascript">
        Ext.newDate = function(time) {
            return new Date(time);
        };
    </script>

Original comment by defav...@gmail.com on 21 Apr 2011 at 2:57

Attachments:

GoogleCodeExporter commented 8 years ago
Matthew, could you please compile your fixed gwtext with 1.5 complier?

Best regards,
Alex Andrushchak

Original comment by andrushc...@gmail.com on 23 May 2011 at 8:33

GoogleCodeExporter commented 8 years ago
That's not me who made the JAR; that's defav...@gmail.com you should direct 
your question to.

Original comment by matthewl...@gmail.com on 23 May 2011 at 5:06

GoogleCodeExporter commented 8 years ago
oops, sorry Mattew.

 defav...@gmail.com could you do it, please?

Original comment by andrushc...@gmail.com on 24 May 2011 at 7:34

GoogleCodeExporter commented 8 years ago
Ok, disregard it. I compiled it myself.
Thanks for fixes.

Best regards,
Alex Andrushchak

Original comment by andrushc...@gmail.com on 27 May 2011 at 9:49

Attachments:

GoogleCodeExporter commented 8 years ago
I am getting a validation error after applying this fix; e.g. a date in 
DateField is 27/02/2011, but the red underline and exclamation mark appear, 
claiming: "27/02/2011 is not a valid date - it must be in the format d/m/Y"

Did anyone encounter this problem? I'm in the middle of tracing the gwtext 
code, but this will probably take a while...

Original comment by yogi.wip...@gmail.com on 21 Jul 2011 at 1:24

GoogleCodeExporter commented 8 years ago
Apparently the function Date.parseDate(...) conflicts with the ISC_Core.js in 
smartclient / smartgwt (which I have included to try out whether it is possible 
to use gwtext and smartgwt together. Would've made porting more incremental and 
thus easier.)

So this little incident made me conclude that it is impossible (or possible but 
very costly) to combine both libraries together.

Original comment by yogi.wip...@gmail.com on 21 Jul 2011 at 4:25