View Full Version : [CLOSED] DatePickerField - Javascript error

Feb 01, 2017, 9:09 PM
Hi, when clicking the date-picker to select a date I get a javascript error "Uncaught TypeError: Cannot read property 'add' of undefined", is there a way around it?

@using Ext.Net.Mobile;
@using Ext.Net.Mobile.MVC;
Layout = null;
var x = Html.X();
<!DOCTYPE html>
<title>Test DatePickerField</title>
.DateValue(new DateTime(2016, 6, 24))

Feb 02, 2017, 12:07 AM
Interesting, @sveins12! Your DatePickerField is defined exactly like the one on the corresponding MVC example (User Interface > Forms > Form Panel (http://mvc.mobile.ext.net/#demo/formpanel)), and it works fine!

It is the 5th field in the example, called Start Date. Can you give the example a try? Does it break on your browser? I just tested it here using chrome in device emulation mode, emulating a Galaxy S5. Maybe there's a specific browser or platform to reproduce the issue?

Feb 02, 2017, 2:58 AM
In the example it works fine. But when I took the code out of the example it fails. I have tried several ways and with more fields and so on, but I cannot get it to work.

I am using Chrome version 56.0.2924.76 (64-bit).

Here is the stack trace:

Uncaught TypeError: Cannot read property 'add' of undefined
at constructor.show (ext-mobile.axd?v=4.1.0:83736)
at constructor.onFocus (ext-mobile.axd?v=4.1.0:84231)
at constructor.onMaskTap (ext-mobile.axd?v=4.1.0:83206)
at constructor.fire (ext-mobile.axd?v=4.1.0:12622)
at constructor.doFireEvent (ext-mobile.axd?v=4.1.0:13258)
at constructor.doFireEvent (ext-mobile.axd?v=4.1.0:26167)
at constructor.prototype.doFireEvent (ext-mobile.axd?v=4.1.0:28224)
at constructor.fireEventArgs (ext-mobile.axd?v=4.1.0:13164)
at constructor.fireAction (ext-mobile.axd?v=4.1.0:13179)
at constructor.onMaskTap (ext-mobile.axd?v=4.1.0:76257)

Feb 02, 2017, 3:09 AM
I figured out now, thanks to FireFox. That browser gave a better message: "TypeError: Ext.Viewport is undefined".

So when I added a viewport it worked.

Feb 02, 2017, 10:48 PM
Oh, sure... the viewport!

Alternatively you can just add a main panel (or fieldset) if that's going to be the only in the page, and give it a Fullscreen="true" setting. It is like a shorthand to setting up the viewport.

Thanks for the feedback and glad you could find the reason the page was breaking!