This is a migrated thread and some comments may be shown as answers.

Default value for nullable value

4 Answers 542 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Konstantin
Top achievements
Rank 1
Konstantin asked on 09 Jul 2019, 04:02 AM

Hello, in example https://dojo.telerik.com/ahepILiP, if field is nullable: true, then default value not used.

In version 2019.2.619 of kendo ui mvc wrappers for all srting values initialize "nullabe: true"

changes: Kendo.Mvc/UI/DataSource/ModelDescriptor.cs

+                    IsNullable = p.ModelType.Name == "String" ? true : p.IsNullableValueType

And all my default values for string fields is null, if remove this changes then work fine.

4 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 10 Jul 2019, 03:49 PM
Hello,

I am afraid that with our last official release we introduced a regression bug that affects applying default values with some fields (in this case string type of fields). Currently we are working on fixing this problem with highest priority and I will let you know in this thread when the fix will be available in the latest internal build. 

In the meantime you can use the  BeforeEdit() event handler to avoid this problem as shown below: 

.Events(e=>e.BeforeEdit("onBeforeEdit"))
<script>
    function onBeforeEdit(e) {
      if(e.model.isNew()){
        e.model.ContactName = "Test";
      }
    }
</script>


Thank you for understanding. 

Regards,
Boyan Dimitrov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Boyan Dimitrov
Telerik team
answered on 18 Jul 2019, 02:49 PM
Hello,

I am glad to inform you that the issue with not applying default values is resolved in our Latest Internal Build (2019.2.718). I would like to encourage you to download the LIB from your account and let us know how that worked. 

Regards,
Boyan Dimitrov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Konstantin
Top achievements
Rank 1
answered on 19 Jul 2019, 02:46 AM

Hello,

Do you fix it in javascript or C#? I am use self resources and compile self library where i remove this changes. Internal build don't conains sources and i can't check it.

0
Alex Hajigeorgieva
Telerik team
answered on 22 Jul 2019, 01:27 PM
Hi, Konstantin,

The changes were made to the wrappers with C#:

Kendo.Mvc/UI/DataSource/ModelDescriptor.cs
Kendo.Mvc/UI/DataSource/ModelFieldDescriptor.cs
Kendo.Mvc/UI/TreeList/TreeListModelDescriptor.cs

I will create a ticket on your behalf and send you these files shortly.

Kind Regards,
Alex Hajigeorgieva
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Konstantin
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Konstantin
Top achievements
Rank 1
Alex Hajigeorgieva
Telerik team
Share this question
or