Error after updating EJS to last version

Hi,

I updated syncfusion librairy to latest version (16.2.0.50) from version (16.1.0.32).

Now I have multiple issue on runtime


On loading, I have «NullReferenceException» error when my bundle is loaded : 



But the new file has the same name and the same path : Scripts/ej2/ej2.min.js

If I include the file manualy in the page I don't have the error...

After that, when I include manualy the file, in my grid, when the DataManager load automaticaly the data, I have error in Javascript Console : 





Do you have any idea why those problem occurs?

6 Replies

VA Venkatesh Ayothi Raman Syncfusion Team August 30, 2018 08:45 AM UTC

Hi Tommy, 


Thanks for the update. 


Query #1: ‘Exception thrown while bundling the Syncfusion Scripts’ 

We have faced the issue when we using Webgrease dll version above 1.6+. We suggest you to use Bundle instead of ScriptBundle like as follows, 

bundles.Add(new Bundle("~/bundles/ej2").Include(
"~/Scripts/ej2/ej2.min.js"));
 

Else, we can use ScriptBundle in webgrease 1.5 and lower version, 
bundles.Add(new ScriptBundle ("~/bundles/ej2").Include(
"~/Scripts/ej2/ej2.min.js"));
 

Please let us know if you have any further assistance on this. 

Query #2:’  I have error in Javascript Console  
We went through your screenshot that you have shared with us and the reported issue was reproduced when we don’t return count from server-side response. For eg, if we use UrlAdaptor to bound the Grid datasource then we should return the response as result and count object. Please refer to the following Help documentation for more information, 



Please let us know if you have any further assistance on this. 

Regards, 
Venkatesh Ayothiraman. 



TM Tommy Mailhot August 31, 2018 06:54 PM UTC

Query 1 resolved

Thank you


TM Tommy Mailhot August 31, 2018 07:17 PM UTC

Query 2 : 

If you check the stack trace, I have a "count" property.

I changed my method in my controller in the same way of your example and I have de same error.

Why it's working in the previous version?


VA Venkatesh Ayothi Raman Syncfusion Team September 3, 2018 10:45 AM UTC

Hi Tommy, 

Thanks for the update. 
 
We are tried to reproduce the issue at our end but it is unsuccessful. We have prepared a simple sample based on your query. Please refer to the below code example and sample link. 

[index.cshtml] 
@Html.EJS().Grid("Grid").DataSource(dataManager => { dataManager.Url("/Home/UrlDatasource").UpdateUrl("/Home/Update") Remove").Adaptor("UrlAdaptor"); }).Columns(col => 
{ 
    .  .  . 
}).AllowPaging().AllowPdfExport().Toolbar(new List<string>() { "PdfExport" }).Render() 

[controller.cs] 
public class HomeController : Controller 
    { 
        .  .  . 
        public ActionResult UrlDatasource(DataManagerRequest dm) 
        { 
            IEnumerable DataSource = orddata.ToList(); 
            DataOperations operation = new DataOperations(); 
 
             .  .  . 
            int count = DataSource.Cast<OrdersDetails>().Count(); 
            // data should be returned as result and count for UrlADaptor 
            return dm.RequiresCounts ? Json(new { result = DataSource, count = count }) : Json(DataSource); 
        } 
} 


Could you please provide the below details that will be helpful for us to provide a better solution as early as possible. 

  1. Share the adaptor type you are using(UrlAdaptor, Webapiadaptor, OdataAdaptor,Odatav4Adaptor, RemoteSaveAdaptor etc.)
  2. Share your Grid code sample
  3. Share your controller code for fetching data for Grid
  4. Share the Network tab window while response from server side.
  5. Please reproduce the issue in the above sample if possible.

 
Regards, 
Venkatesh Ayothiraman. 



TM Tommy Mailhot September 4, 2018 01:05 PM UTC

[Index.cshtml]
@Html.EJS().Grid("EmployeeWeekTimeSummary").DataSource(dataManager =>
       {
           dataManager.Url(Url.Action("LoadTimeSummaryPerEmployee/", "MachineTimePerEmployee")).Adaptor("UrlAdaptor");
       }).ActionComplete("EmployeeWeekTimeSummaryActioncomplete").SelectedRowIndex(0).Height("300").AllowSelection(true).Width("auto").Columns(col =>
       {
           col.Field("RowId").HeaderText("").IsPrimaryKey(true).AllowEditing(false).HeaderText("").Visible(false).Width("0").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Left).Add();
           col.Field("Name").HeaderText("Nom").AllowEditing(false).Visible(true).Width("100").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Left).Add();
           col.Field("SundayHours").HeaderText("Dimanche").AllowEditing(false).Visible(true).Width("100").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Left).Add();
           col.Field("MondayHours").HeaderText("Lundi").AllowEditing(false).Visible(true).Width("100").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Left).Add();
           col.Field("TuesdayHours").HeaderText("Mardi").AllowEditing(false).Visible(true).Width("100").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Left).Add();
           col.Field("WednesdayHours").HeaderText("Mercredi").AllowEditing(false).Visible(true).Width("100").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Left).Add();
           col.Field("ThursdayHours").HeaderText("Jeudi").AllowEditing(false).Visible(true).Width("100").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Left).Add();
           col.Field("FridayHours").HeaderText("Vendredi").AllowEditing(false).Visible(true).Width("100").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Left).Add();
           col.Field("SaturdayHours").HeaderText("Samedi").AllowEditing(false).Visible(true).Width("100").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Left).Add();
           col.Field("TotalHours").HeaderText("Total").AllowEditing(false).Visible(true).Width("100").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Left).Add();

       }).RowSelected("EmployeeSelected").Render()

[Controller.cs]
 
[HttpPost]
        public ActionResult LoadMachineTimePerEmployee(string employeId, DataManagerRequest dm)
        {
            List<MachineTimePerEmployeeEditorPopupViewModel> machineTimePerEmployee = new List<MachineTimePerEmployeeEditorPopupViewModel>();
            try
            {
                //int id = this.LiardIndustriesContext.Employee.Where(e => e.RowUuid.Equals(employeId)).ToList().First().RowId;
                machineTimePerEmployee = this.LiardIndustriesContext.MachineTimePerEmployee.ToList().OrderBy(mtpe => mtpe.MachineId).Where(mtpe => mtpe.Employee.RowUuid.Equals(employeId) && mtpe.Employee.IsActif == true).Select(mtpe => new MachineTimePerEmployeeEditorPopupViewModel() { machineTimePerEmployee = mtpe }).ToList();
                
            }
            catch (Exception e)
            {

            }
            //return Json(JsonConvert.SerializeObject(new ResultListViewModel<MachineTimePerEmployeeEditorPopupViewModel>(machineTimePerEmployee)), JsonRequestBehavior.AllowGet);

            return Json(new { result = machineTimePerEmployee, count = machineTimePerEmployee.Count() });
        }

Answer of my controller in Network Tab

"{\"result\":[{\"MondayHours\":16.0,\"TuesdayHours\":16.0,\"WednesdayHours\":16.0,\"ThursdayHours\":16.0,\"FridayHours\":16.0,\"SaturdayHours\":0.0,\"SundayHours\":0.0,\"TotalHours\":80.0,\"Name\":\"Bob Gratton\",\"RowId\":\"0B98B8E4-B8CA-43DE-90A5-A6103A352BCA\"},{\"MondayHours\":12.0,\"TuesdayHours\":12.0,\"WednesdayHours\":12.0,\"ThursdayHours\":12.0,\"FridayHours\":12.0,\"SaturdayHours\":0.0,\"SundayHours\":0.0,\"TotalHours\":60.0,\"Name\":\"Marc-André Dubois\",\"RowId\":\"7DBE145A-C59E-4E44-A5B5-5E471001E1F8\"},{\"MondayHours\":16.0,\"TuesdayHours\":16.0,\"WednesdayHours\":16.0,\"ThursdayHours\":16.0,\"FridayHours\":16.0,\"SaturdayHours\":0.0,\"SundayHours\":0.0,\"TotalHours\":80.0,\"Name\":\"Employé Test 1\",\"RowId\":\"B3AE8B85-2274-4A3A-BDDA-C971D6E6D13F\"},{\"MondayHours\":14.0,\"TuesdayHours\":14.0,\"WednesdayHours\":14.0,\"ThursdayHours\":14.0,\"FridayHours\":14.0,\"SaturdayHours\":0.0,\"SundayHours\":0.0,\"TotalHours\":70.0,\"Name\":\"Employé Test 2\",\"RowId\":\"990EE2F8-2A0B-4C70-B9F5-9039094FB390\"}],\"count\":4}"




VA Venkatesh Ayothi Raman Syncfusion Team September 5, 2018 12:56 PM UTC

Hi Tommy, 
 
 
We have created a new incident under your account to follow up with this query. We suggest you follow up the incident for further updates using your direct trac account.  
 
Regards, 
Venkatesh Ayothiraman. 


Loader.
Up arrow icon