Default column value not set properly

I'm having trouble with one particular grid column. The grid is the detail side of a master-detail, therefore needs to have a hidden column with the default value equal to the parent's key. The razor source is

     <e-column field="OrderID"
              visible="false"
              type="number"
              [email protected] />

I can see in the page source that the value is correct:

     {"field":"OrderID","type":"number","visible":false,"defaultValue":122}

but when the insert is sent back to the server, it has a different value:

{"value":{"OrderID":40,"Name":"Apple Bread","Quantity":1,"Sliced":0,"LightBake":false,"Plastic":false, "Bulk":0,"Notes":null,"ProductID":24},"table":null,"action":"insert","antiForgery":""}

This value, 40, is the same across multiple runs of the web app, and across client computers and servers.

I don't do anything to set this value other than the default-value attribute; i.e., i don't have any scripts client-side that would change it. Other columns that have a default-value, such as Quantity, Sliced, and Bulk have their proper values.

I have not been able to reproduce it in a sample app, and I'm hesitant to send my actual project, as it's pretty large. Do you have any suggestions where I should look to fix this problem? Is there any chance that there's an unobfuscated JS file available so that I could debug into the EJ source?

Thank you again for your help.

Brian


2 Replies

RB R Brian Lindahl March 13, 2018 05:11 PM UTC

Additional note: I cleaned up some code by renaming the OrderID field to StandingOrderiD. Now the consistently wrong value is 0 instead of 40. I didn't change anything besides the renamed field.


SE Sathyanarayanamoorthy Eswararao Syncfusion Team March 13, 2018 05:17 PM UTC

Hi Brian, 

We are unable to reproduce the mentioned issue on our end. We have prepared a sample with the same requirement and the same can be found below. 


Refer the below code example. 

 
  <ej-grid id="Grid" allow-paging="true" allow-filtering="true"  selectiontype="Multiple" action-complete="complete"> 
                 
         ------------------------- 
 
                <e-columns> 
                    <e-column field="OrderID" is-primary-key="true" visible="false" default-value="122"></e-column> 
                    <e-column field="EmployeeID" header-text="EmployeeID" default-value="9"></e-column> 
                    <e-column field="Freight" header-text="Freight" default-value="4.00"></e-column> 
                 </e-columns> 
            </ej-grid> 
 
 
 

Refer the screenshot. 
 


If you still face the issue please share the following details. 

1.       Complete code example of grid. 
2.       Syncfusion Essential studio version. 
3.       Video or Screenshot of replication procedure of issue. 
4.       If possible please try to reproduce the mentioned issue in attached sample. 

The provided details will help us to analyze the issue and provide solution as soon as possible. 

Regards, 
Sathyanarayanamoorthy 


Loader.
Up arrow icon