No save/update action in inline edit with grid when value is null
Hi,
i have a grid with data bound with the datamanager. Everything works fine, the create/update events are triggered on the dataadapter, paging etc works and the data will be saved on the API for one exception:
I have a text column (Description) which is nullable in the database. If the field value is null and I edit the value (set some value) and click on the save button nothing happens.
Only the edit mode in the grid row disappears but no save request is fired. If I change some other value in the row the save event is fired. Seems that if only a value changes from null to not null the event is not fired.
My grid :
<e-column [isPrimaryKey]="true" [isIdentity]="true" field="Id" headerText="ID" width="75" textAlign="right"></e-column>
<e-column field="Name" headerText="Name"></e-column>
<e-column field="Description" headerText="Description" [clipMode]="ellipsis"></e-column>
<e-column field="IsActive" headerText="Active" width="95" textAlign="left" editType="booleanedit"></e-column>
<e-column headerText="Manage" [commands]="buttons" width="100"></e-column>
<e-column field="Name" headerText="Name"></e-column>
<e-column field="Description" headerText="Description" [clipMode]="ellipsis"></e-column>
<e-column field="IsActive" headerText="Active" width="95" textAlign="left" editType="booleanedit"></e-column>
<e-column headerText="Manage" [commands]="buttons" width="100"></e-column>
The description is nullable.
The json data
{
"count": 2,
"result": [{
"Id": 1,
"Description": null,
"IsActive": true,
"Name": "Test 1"
},
{
"Id": 2,
"Description": "Description 2",
"IsActive": true,
"Name": "Test 2"
}]
}
"count": 2,
"result": [{
"Id": 1,
"Description": null,
"IsActive": true,
"Name": "Test 1"
},
{
"Id": 2,
"Description": "Description 2",
"IsActive": true,
"Name": "Test 2"
}]
}
Any suggestions?
SIGN IN To post a reply.
5 Replies
VN
Vignesh Natarajan
Syncfusion Team
November 15, 2017 04:51 PM UTC
Hi Martin,
Thanks for using Syncfusion support
Based on suggestion we have prepared a sample with datamanager using urlAdaptor. We are not able to reproduce the reported issue at our end. The sample can be downloaded from below link
Note: after running the sample open this local host to open the sample
http://localhost:49339/angular2/ejGrid_Vpaging%20-%20Copy/ejGrid_Vpaging/
So Kindly share the following details to help you better
- Share the full grid rendering code
- Share the screenshot of the script error in the console window(if any)
- What type of adaptor you are using?
- If possible try to reproduce the issue in provided sample
Regards,
Vignesh Natarajan
MS
Martin Strojek
November 16, 2017 08:35 AM UTC
Hi,
did not install the .NET components so a reference is missing.
However, I managed to reproduce in one of your online examples:
Visit http://js.syncfusion.com/demos/web/#!/bootstrap/grid/editing/inlineonlocaldata
Go to edit to open in jsplayground
Overwrite the grid data with this value:
window.gridData=[{OrderID:10248,CustomerID:"VINET",EmployeeID:5,OrderDate:new Date(8364186e5),ShipName:null,ShipCity:"Reims",ShipAddress:"59 rue de l'Abbaye",ShipRegion:null,ShipPostalCode:"51100",ShipCountry:"France",Freight:32.38,Verified:!0},{OrderID:10249,CustomerID:"TOMSP",EmployeeID:6,OrderDate:new Date(836505e6),ShipName:"Toms Spezialitäten",ShipCity:"Münster",ShipAddress:"Luisenstr. 48",ShipRegion:null,ShipPostalCode:"44087",ShipCountry:"Germany",Freight:11.61,Verified:!1},{OrderID:10250,CustomerID:"HANAR",EmployeeID:4,OrderDate:new Date(8367642e5),ShipName:"Hanari Carnes",ShipCity:"Rio de Janeiro",ShipAddress:"Rua do Paço, 67",ShipRegion:"RJ",ShipPostalCode:"05454-876",ShipCountry:"Brazil",Freight:65.83,Verified:!0}];
and place just before the grid function.
You will get this code:
...
...
<script type="text/javascript">
window.gridData=[{OrderID:10248,CustomerID:"VINET",EmployeeID:5,OrderDate:new Date(8364186e5),ShipName:null,ShipCity:"Reims",ShipAddress:"59 rue de l'Abbaye",ShipRegion:null,ShipPostalCode:"51100",ShipCountry:"France",Freight:32.38,Verified:!0},{OrderID:10249,CustomerID:"TOMSP",EmployeeID:6,OrderDate:new Date(836505e6),ShipName:"Toms Spezialitäten",ShipCity:"Münster",ShipAddress:"Luisenstr. 48",ShipRegion:null,ShipPostalCode:"44087",ShipCountry:"Germany",Freight:11.61,Verified:!1},{OrderID:10250,CustomerID:"HANAR",EmployeeID:4,OrderDate:new Date(8367642e5),ShipName:"Hanari Carnes",ShipCity:"Rio de Janeiro",ShipAddress:"Rua do Paço, 67",ShipRegion:"RJ",ShipPostalCode:"05454-876",ShipCountry:"Brazil",Freight:65.83,Verified:!0}];
$(function () {
$("#Grid").ejGrid({
window.gridData=[{OrderID:10248,CustomerID:"VINET",EmployeeID:5,OrderDate:new Date(8364186e5),ShipName:null,ShipCity:"Reims",ShipAddress:"59 rue de l'Abbaye",ShipRegion:null,ShipPostalCode:"51100",ShipCountry:"France",Freight:32.38,Verified:!0},{OrderID:10249,CustomerID:"TOMSP",EmployeeID:6,OrderDate:new Date(836505e6),ShipName:"Toms Spezialitäten",ShipCity:"Münster",ShipAddress:"Luisenstr. 48",ShipRegion:null,ShipPostalCode:"44087",ShipCountry:"Germany",Freight:11.61,Verified:!1},{OrderID:10250,CustomerID:"HANAR",EmployeeID:4,OrderDate:new Date(8367642e5),ShipName:"Hanari Carnes",ShipCity:"Rio de Janeiro",ShipAddress:"Rua do Paço, 67",ShipRegion:"RJ",ShipPostalCode:"05454-876",ShipCountry:"Brazil",Freight:65.83,Verified:!0}];
$(function () {
$("#Grid").ejGrid({
...
...
After that run the example. The Ship Name of the first item is empty. If you edit it and click save the field will stay empty, the modification will not be saved!
VN
Vignesh Natarajan
Syncfusion Team
November 17, 2017 05:28 PM UTC
Hi Martin,
Thanks for the update.
We have prepared a sample based on your suggestion and we are able to reproduce the reported issue. By default the column type will found based on the value. But when the value is null, its type will be undefined so the edit form cannot save its value. So, we suggest you to specify the column type using type property of the column.
Refer the below code snippet
|
{ field: "ShipName", headerText: 'Ship Name', width: 150,type:"string" }, |
For your convenience we have prepared a JSplayground sample
If the issue still exist kindly share the full grid rendering code or issue reproduceable sample
Regards,
Vignesh Natarajan
MS
Martin Strojek
November 20, 2017 10:44 AM UTC
Thanks a lot. the type fixed the issue.
VN
Vignesh Natarajan
Syncfusion Team
November 21, 2017 04:09 AM UTC
Hi Martin,
Thanks for the update.
We are happy that your issue has been resolved by our solution.
Kindly get back to us if you need any further assistance.
Regards,
Vignesh Natarajan
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
-
MS Martin Strojek
- Nov 14, 2017 01:33 PM UTC
- Nov 21, 2017 04:09 AM UTC