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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Js error when trying to perform server delete

Thread ID:

Created:

Updated:

Platform:

Replies:

129622 Mar 25,2017 02:04 PM Mar 27,2017 04:53 AM ASP.NET MVC 1
loading
Tags: Grid
MikeB
Asked On March 25, 2017 02:04 PM

I get the js error when I'm trying to delete object listed on the grid.
The error message displayed in Firefox console is "TypeError: r is null   ej.web.all.min.js:10:36786"

This is how I setup the grid:

@(Html.EJ().Grid<TransactionViewModel>("transactionsGrid")
        .Datasource(ds => ds.Json(Model).RemoveURL("/Expenses/Remove").Adaptor(AdaptorType.RemoteSaveAdaptor))
        .IsResponsive(true).EditSettings(e =>
          {
              e.AllowDeleting();
          }).ToolbarSettings(t => t.ShowToolbar().ToolbarItems(i =>
          {
              i.AddTool(ToolBarItems.Delete);
          }))
          .Columns(col =>
          {

              col.Field(p => p.Expense.Date).Format("{0:dd-MM-yyyy}").HeaderText(ResourcesDataProvider.GetStringFromResourceFile(Strings.Date)).Width("100").Add();
              col.Field(p => p.Expense.Goal).HeaderText(ResourcesDataProvider.GetStringFromResourceFile(Strings.Goal)).Width("200").Add();
              col.Field(p => p.Expense.Value).HeaderText(ResourcesDataProvider.GetStringFromResourceFile(Strings.Value)).Width("150").Add();
              col.Field(p => p.PayerName).HeaderText(ResourcesDataProvider.GetStringFromResourceFile(Strings.UserName)).Width("200").Add();
              col.Field(p => p.Expense.Description).HeaderText(ResourcesDataProvider.GetStringFromResourceFile(Strings.Description)).Add();
          }))



Prasanna Kumar Viswanathan [Syncfusion]
Replied On March 27, 2017 04:53 AM

Hi Michal, 

Thanks for contacting Syncfusion support. 

In your code example we found that you have not set PrimaryKey field in Grid Columns which is the cause of the issue. While performing delete operation we delete the record using primarykey. In order to resolve the issue, set “isPrimaryKey” property to the Primary key column. 
 
Find the code example:  
 
 
.Columns(col => 
     { 
         col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(100).ValidationRules(v => v.AddRule("required", true).AddRule("minlength", 3)).Add(); 
         col.Field("CustomerID").HeaderText("Customer ID").TextAlign(TextAlign.Right).Width(90).Add(); 
         -------------------------- 
    }) 

Regards, 
Prasanna Kumar N.S.V 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;