We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Problems with saving a modified record with Inline Editing Template

Hi,

I have got a grid like this:

@(Html.EJ().Grid<SlimHub.Models.Site>("SitesGrid")
.Datasource(ds =>ds.Json((IEnumerable<Site>)Model.Sites.ToList()).UpdateURL("../NormalSiteUpdate").InsertURL("../NormalSiteInsert").RemoveURL("../NormalSiteDelete").Adaptor(AdaptorType.RemoteSaveAdaptor))
.EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.InlineFormTemplate).InlineFormTemplateID("#customerInlineFormTemplate"); })
                  .ToolbarSettings(toolbar =>
                  {
                      toolbar.ShowToolbar().ToolbarItems(items =>
                      {
                          items.AddTool(ToolBarItems.Add);
                          items.AddTool(ToolBarItems.Edit);
                          items.AddTool(ToolBarItems.Delete);
                          items.AddTool(ToolBarItems.Update);
                          items.AddTool(ToolBarItems.Cancel);
                      });
                  })
                  .AllowResizing()
                  .AllowTextWrap(true)
                  .DetailsTemplate("#SiteDetailsTemplate")
                  .Columns(col =>
                  {
                      col.Field("SiteId").HeaderText("ID").HeaderTextAlign(TextAlign.Center).IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(0).Visible(false).Add();
                      col.Field("CustomerId").Width(0).Visible(false).DefaultValue(Model.CustomerId).Add();
                      col.Field("InsertDate").HeaderText("Data Ins.").TextAlign(TextAlign.Center).DefaultValue(DateTime.Now).EditType(EditingType.DateTimePicker).Format("{0:dd/MM/yyyy}").Visible(false).Width(20).Add();
                      col.Field("SiteName").HeaderText("Denominazione").Template("#siteNameTemplate").HeaderTextAlign(TextAlign.Center).Width(30).Visible(true).Add();
                  })
                  .ClientSideEvents(eve =>
                  {
                      eve.ActionComplete("siteComplete");
                  })
                            )

The custom editing inline template is defined as below:

<script id="customerInlineFormTemplate" type="text/template">
    <div class="Row">
        <div class="SubHeaderColumn">Dettagli Sito Operativo</div>
        <div class="siteGroup">
            <table class="SiteTable" cellpadding="2">
                <colgroup>
                    <col width="10%">
                    <col width="90%">
                </colgroup>
                <tbody>
                    <tr>
                        <td>Denominazione</td>
                        <td class="siteData">
                            <input id="SiteName" name="SiteName" value="{{: SiteName}}" class="e-field e-ejinputtext valid" />
                            <input type="hidden" id="SiteId" name="SiteId" value="{{: SiteId}}" />
                            <input type="hidden" id="CustomerId" name="CustomerId" value="{{: CustomerId}}" />
                            <input id="InsertDate" name="InsertDate" value="{{: InsertDate}}" />
                        </td>
                    </tr>
                    <tr>
                        <td>Sede Legale</td>
                        <td class="siteData">
                            {{if IsLegalSite}} <input type="checkbox" id="IsLegalSite" checked="checked" name="IsLegalSite" class="e-field e-ejinputtext valid" style="text-align: center;" />{{else}} <input type="checkbox" id="IsLegalSite" name="IsLegalSite" class="e-field e-ejinputtext valid" style="text-align: center;" />{{/if}}
                        </td>
                    </tr>
                    <tr>
                        <td>Sede Operativa</td>
                        <td class="siteData">
                            {{if IsOperatingSite}} <input type="checkbox" id="IsOperatingSite" checked="checked" name="IsOperatingSite" class="e-field e-ejinputtext valid" style="text-align: center;" />{{else}} <input type="checkbox" id="IsOperatingSite" name="IsOperatingSite" class="e-field e-ejinputtext valid" style="text-align: center;" />{{/if}}
                        </td>
                    </tr>
                    <tr>
                        <td>Nazione</td>
                        <td class="siteData">
                            <select id="Country" name="Country">
                                <option value="Albania">Albania</option>
                                <option value="Andorra">Andorra</option>
                                <option value="Austria">Austria</option>
                                <option value="Belgio">Belgio</option>
                                <option value="Danimarca">Danimarca</option>
                                <option value="Finlandia">Finlandia</option>
                                <option value="Francia">Francia</option>
                                <option value="Germania">Germania</option>
                                <option value="Gran Bretagna">Gran Bretagna</option>
                                <option value="Irlanda">Irlanda</option>
                                <option value="Italia">Italia</option>
                                <option value="Norvegia">Norvegia</option>
                                <option value="Polonia">Polonia</option>
                                <option value="Portogallo">Portogallo</option>
                                <option value="Spagna">Spagna</option>
                                <option value="Svezia">Svezia</option>
                                <option value="Svizzera">Svizzera</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>Regione</td>
                        <td class="siteData">
                            <input id="Region" name="Region" value="{{: Region}}" class="e-field e-ejinputtext valid" style="display: inline-block; text-align: left;" />
                        </td>
                    </tr>
                    <tr>
                        <td>Provincia</td>
                        <td class="siteData">
                            <input id="Province" name="Province" value="{{: Province}}" class="e-field e-ejinputtext valid" style="text-align: left;" />
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <br />
    </div>
</script>

There is a very strange behaviour:

If I add or delete a record from the grid, everything is OK.
When I try to modify a record and then click on the Save button, changes are recognized only if I modify the text of the first field (highlighted). 
If I leave that field unchanged, when I save the record, the args.requestType is CANCEL and so the update CRUD method is not called.

I'm using version 15.1.0.41 of Essential Studio and updated the js libraries...

Can you help me?

Thanks

1 Reply

JK Jayaprakash Kamaraj Syncfusion Team May 4, 2017 10:27 AM UTC

Hi Claudio, 

Thank you for contacting Syncfusion support. 
 
The reported issue is a known issue. This issue Server side is not triggered while using inline form template” has been fixed internally and the fix for the issue will be included in our Volume 2, 2017 service pack 1 release which has been scheduled to be roll out by the month of May 2017. 
We can also provide a custom patch for this if you are in need of a solution sooner. 
As a workaround we suggest you to enable the this._isEditChangesApplied in the actionBegin event of ejGrid with the condition of requestType as save.  

@{ 
    ViewBag.Title = "Home Page"; 
} 
@using Syncfusion.JavaScript.Models 
 
@(Html.EJ().Grid<object>("Grid") 
      .Datasource(d => d.Json((IEnumerable<object>)ViewBag.data).UpdateURL("/Home/ChildUpdate").InsertURL("/Home/ChildInsert").RemoveURL("/Home/ChildDelete").Adaptor(AdaptorType.RemoteSaveAdaptor)) 
                        
                  .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.InlineFormTemplate).InlineFormTemplateID("#customerInlineFormTemplate"); }) 
.. 
                        .AllowPaging() 
                        .ClientSideEvents(eve => eve.Load("load")) 
                        .Columns(col => 
                        { 
                            col.Field("OrderID").HeaderText("OrderID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add(); 
                        }).ClientSideEvents(eve=>eve.ActionComplete("complete").ActionBegin("begin"))) 
          
<script type="text/javascript"> 
    function begin(args) { 
     
            if (args.requestType == "save")  
                this._isEditChangesApplied = true;  
    } 
</script> 




Regards, 

Jayaprakash K. 

 


Loader.
Live Chat Icon For mobile
Up arrow icon