[CLOSED] [#1452] [4.2.0] DatePickerField set date value from view causes NullReferenceException

  1. #1

    [CLOSED] [#1452] [4.2.0] DatePickerField set date value from view causes NullReferenceException

    Hi all,
    I try to set DatePickerField's DateValue from view, to set a default date value
    but it gives NullReferenceException..

    @using Ext.Net.Mobile;
    @using Ext.Net.Mobile.MVC;
        Layout = null;
        var X = Html.X();
    <!DOCTYPE html>
        <title>Ext.NET Mobile MVC Sample</title>
    Last edited by fabricio.murta; Mar 24, 2017 at 1:37 AM.
  2. #2
    Hello @unicorn64!

    Thanks for reporting the issue!

    Seems there are problems on Ext.NET side -and- ExtJS's. ExtJS manual is not clear on which value type should be used there also, but seems passing a JavaScript Date() object does the trick!

    Try this:

    .CustomConfig(c =>
        c.Add(new ConfigItem()
            Name = "value",
            Value = String.Format("new Date({0}, {1}, {2})", DateTime.Today.Year, DateTime.Today.Month - 1, DateTime.Today.Day),
            Mode = ParameterMode.Raw
    Instead of [var].DateValue(...)[/b].

    This should get you up and running for the time being. And won't just break on next release either. (at least immediate next release 4.2.0 based on ExtJS 6.2.1!)

    ExtJS 6.2.1 (1) manual claims it can be specified in the following format :

    value: { year: 2017, month: 3, day: 23 },
    But it didn't work at all, new version of ExtJS seems to also support only and only the JS Date() object parameter.

    We've just created issue #1452 to track this defect. As soon as we fix it, we'll post a follow-up here!

    (1): current Ext.NET is based on ExtJS 6.0.2, and we're currently working on setting up Ext.NET with ExtJS 6.2.1!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hello again, @unicorn64!

    Well, looks like the fix was not really tough! We have just fixed and it will be available on the upcoming 4.2.0 release, so stay tuned!

    For premium subscription users, the fix would already be available, but it has been made in the branch we are merging ExtJS 6.2.1 (unstable), but it would be easy to cherry-pick the change to current master if anyone needed this fixed immediately!

    Thanks again for reporting us the issue! Looking forward to your feedback about the workaround provided!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. [CLOSED] DatePickerField - Date format
    By sveins12 in forum Mobile Help
    Replies: 5
    Last Post: Feb 27, 2017, 7:36 AM
  2. [CLOSED] DatePickerField - Javascript error
    By sveins12 in forum Mobile Help
    Replies: 4
    Last Post: Feb 02, 2017, 10:48 PM
  3. Replies: 1
    Last Post: May 02, 2012, 2:40 PM
  4. Replies: 2
    Last Post: Jan 10, 2012, 6:35 AM
  5. [CLOSED] Date Format on Group View
    By dev in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 12, 2010, 11:59 PM

Posting Permissions