[CLOSED] [#908] [3.3] [MVC] Nullable fields for StoreFor.

  1. #1

    [CLOSED] [#908] [3.3] [MVC] Nullable fields for StoreFor.

    Hello Ext.Net team,

    StoreFor method doesn't check nullable properties and can set default value to the grid cell. I think it isn't correct in case if value is null.

    public class Test
    {
      public decimal? Value { get; set; }
    }
    If I use StoreFor(m => m.Test) I always see Value in column even if Value is null.
    I think better way is to set AllowNull(true) to ModelField for nullable properties.
    Last edited by Daniil; Sep 22, 2015 at 7:26 PM. Reason: [CLOSED] [#908] [3.3]
  2. #2
    Hi Yury,

    Thank you for the suggestion.

    I was going to suggest this:
    [ModelField(AllowNull = true)]
    public decimal? Value { get; set; }
    but found out that a ModelFieldAttribute is missing an AllowNull option. Created an Issue for that and added in the revision 6573 (trunk). It goes to the 3.3 release.
    https://github.com/extnet/Ext.NET/issues/907

    Should it be true by default for nullable types? Well, I am not 100% sure it should, but I tend to agree.

    Created a feature request issue.
    https://github.com/extnet/Ext.NET/issues/908

    Done in the revision 6574 (trunk). It goes to the 3.3 release.

    Please note that AllowNull is set to true by default only if a Model's property doesn't have a ModelField attribute applied. If it is applied, when AllowNull is set to false by default as for any ModelField and you can change it by [ModelField(AllowNull = true)].

Similar Threads

  1. Replies: 15
    Last Post: Nov 16, 2013, 12:31 AM
  2. [CLOSED] How to use StoreFor Model
    By UnifyEducation in forum 2.x Premium Help
    Replies: 3
    Last Post: Oct 18, 2012, 2:09 PM
  3. Nullable Parameters
    By Zdenek in forum 1.x Help
    Replies: 1
    Last Post: Mar 16, 2012, 7:54 PM
  4. Nullable int fields showing as zeroes
    By daneel in forum Feature Requests
    Replies: 7
    Last Post: Mar 21, 2011, 7:49 PM
  5. nullable TextField with Vtype of email
    By javadzarrin in forum 1.x Help
    Replies: 1
    Last Post: Sep 06, 2010, 8:40 PM

Posting Permissions