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

Uncaught TypeError: Cannot read property 'helpers' of undefined

I am creating a grid view and this error is coming:
Uncaught TypeError: Cannot read property 'helpers' of undefined on  ej.web.all.min.js
The grid shows headers, pager, and counts: [1 of 25 pages (500 items)], but not a single row is rendered (Screenshot attached)

Attachment: 20160531_11_29_38_DW_Test_Scores_4ce8b220.zip

6 Replies

RU Ragavee U S Syncfusion Team June 1, 2016 05:25 AM UTC

Hi Lucio, 

Thanks for your interest in Syncfusion products. 

The reported issue may occur only when you are failed to refer the jsrender.min.js in your sample project. The jsrender.js file is used to render the templates. 

Refer to the following code example and refer the jsrender.min.js in your application.

 
<head> 
    <title>Essential Studio for JavaScript : Inline on Local data</title> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 
    <meta charset="utf-8" /> 
    <link rel='nofollow' href="../css/default-theme/ej.widgets.all.min.css" rel="stylesheet" /> 
    <script src="../external/jquery-2.1.4.min.js"></script> 
    <script src="../external/jquery.easing.1.3.min.js"></script> 
    <script src="../external/jsondata.min.js"></script> 
    <script src="../external/jsrender.min.js"></script> 
       <script src="../external/ej.web.all.min.js"></script>
</head> 

Refer to the following Help Documents about Grid’s dependency scripts.

http://help.syncfusion.com/js/grid/getting-started
http://help.syncfusion.com/js/dependencies

We have prepared a sample that can be referred from the following jsPlayground.

http://jsplayground.syncfusion.com/ywwxhmcm 

Regards, 
Ragavee U S. 



LA Lucio A. Da Silva June 1, 2016 01:56 PM UTC

Thanks, that solved this problem.
Although it was referenced in the page, it was not in the scripts folder,


LA Lucio A. Da Silva June 1, 2016 09:03 PM UTC

Hello,

Now I am having this error:

ej.web.all.min.js:10 
Uncaught DataManager - executeLocal() : A query is required to execute
Error: DataManager - executeLocal() : A query is required to execute
    at u (http://localhost:14816/Scripts/ej/ej.web.all.min.js:10:79674)
    at Object.t.DataManager.executeLocal (http://localhost:14816/Scripts/ej/ej.web.all.min.js:10:26417)
    at Object.<anonymous> (http://localhost:14816/Scripts/ej/ej.web.all.min.js:10:25899)u @ ej.web.all.min.js:10t.DataManager.executeLocal @ ej.web.all.min.js:10(anonymous function) @ ej.web.all.min.js:10

this is my grid:

@{
    ViewBag.Title = "Grid";
    Layout = null;
    IEnumerable<object> dataSource = (IEnumerable<object>)ViewBag.datasource;
    List<Column> cols = (List<Column>)ViewBag.columns;
}
@(Html.EJ().Grid<StudentTestScores>("gvStudentsScores")
            .Datasource(ds => ds.Json(dataSource).Adaptor(AdaptorType.JsonAdaptor))
        .ToolbarSettings(toolBar => toolBar.ShowToolbar().ToolbarItems(items =>
        {
            items.AddTool(ToolBarItems.ExcelExport);
            items.AddTool(ToolBarItems.WordExport);
            items.AddTool(ToolBarItems.PdfExport);
            items.AddTool(ToolBarItems.PrintGrid);
        }))
        .AllowSorting()
        .AllowPaging()
        .PageSettings(page => { page.PageSize(20); })
        .Columns(cols)
)
 
@Html.EJ().ScriptManager()


GV Gowthami V Syncfusion Team June 2, 2016 11:02 AM UTC

Hi Lucio, 

The reported issue will occur only if the grid model query is not an instance of ejQuery and if the model query is altered manually. So could you please let us know if you have performed any custom operation in any event of the grid? 

If so, please share the corresponding code for our reference. We have created a sample with the information that you have shared, which can be downloaded from the below location. 


Please try the sample and if you still face any difficulties, please share below details. 

1.       If you obtaining the error during initial rendering or while performing any operation in grid? 
2.       Please share your view page and server side code 
3.       If possible, please reproduce the issue in the above provided sample and provide. 

Regards, 
Gowthami V. 



LA Lucio A. Da Silva June 2, 2016 12:14 PM UTC

The grid is in a partial view which is to be updated according to users' selection, including different data and add/remove columns
this is the PartialViewResult
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
public PartialViewResult GetReport(string[] ids, string year, string schoolCode, string schoolGrade, int? page, string[] demoIds)
{
    var ds = GetStudentsScoresData(ids, year, schoolCode, schoolGrade, demoIds);
    ViewBag.datasource = ds.ToList();
 
    //return PartialView("_GridView", GetStudentsScoresData(ids, year, schoolCode, schoolGrade, demoIds));
    return PartialView("_GridView");
 
} // end of PartialViewResult GetReport
public IEnumerable<object> GetStudentsScoresData(string[] ids, string year, string schoolCode, string schoolGrade, string[] demoIds)
{
    StudentRepository studentRepository = new StudentRepository();
    IEnumerable<StudentTestScores> students = new List<StudentTestScores>();
 
    if (ids != null && demoIds == null)
    {
        var selectedIds = string.Join(",", ids);
        students = studentRepository.GetStudentData(selectedIds, year, schoolCode, schoolGrade);
    }
    else if (ids != null && demoIds != null)
    {
        var selectedIds = string.Join(",", ids);
        var selectedDemoIds = string.Join(",", demoIds);
        students = studentRepository.GetStudentTestScoreAndDemographicsData(selectedIds, year, schoolCode, schoolGrade, selectedDemoIds);
    }
    else
    {
        students = studentRepository.GetAll(); //studentRepository.GetAll();
    }
 
    StudentTestScores studentTestScore = students.First();
    Type modelType = studentTestScore.GetType();
    IList<PropertyInfo> props = new List<PropertyInfo>(modelType.GetProperties());
 
    IList<object> dataSource = new List<object>();
    IList<string> headers = new List<string>();
 
    foreach (StudentTestScores sts in students)
    {
        Dictionary<stringstring> dic = new Dictionary<stringstring>();
        foreach (PropertyInfo prop in props)
        {
            string propName = prop.Name;
            var val = prop.GetValue(sts, null);
            if (val != null && propName != "StudNo" && propName != "SchoolYear" && propName != "Data")
            {
                string header = propName;
                string myType = val.GetType().Name.ToString();
                if (myType.ToLower().Contains("list")) // this is ScoreInfo
                {
                    var scoreInfoLst = (List<ScoreInfo>)val;
                    if (scoreInfoLst.Count > 0)
                    {
                        ScoreInfo scoreInfo = scoreInfoLst[0];
                        header = String.Format("{0} {1} {2}", scoreInfo.SubjectName, scoreInfo.AdministrationName, propName);
                        dic.Add(header, scoreInfo.Score.ToString());
                        if (!headers.Contains(header))
                        {
                            headers.Add(header);
                        }
 
                    }
                }
                else
                {
                    if (header == "FirstName") header = "First Name";
                    if (header == "LastName") header = "Last Name";
                    dic.Add(header, val.ToString());
                    if (!headers.Contains(header))
                    {
                        headers.Add(header);
                    }
 
                }
            }
        }
 
        dataSource.Add((object)dic);
    }
 
    List<Column> cols = new List<Column>();
    foreach (string h in headers)
    {
        cols.Add(new Column() { Field = h, HeaderText = h });
    }
    ViewBag.columns = cols;
 
    return (IEnumerable<object>)dataSource;
 
} // end of GetStudentsScoresData


RU Ragavee U S Syncfusion Team June 3, 2016 12:31 PM UTC

Hi Lucio, 

We have created a sample with all the information that you have shared(both the view and controller page), which can be downloaded from the below location.  


Please reproduce the sample in the above sample and share. Also, please share below details. 

1.       If you are referring individual scripts or custom script in your sample? 
2.       Are you using any other Syncfusion control in your project? 
3.       Is the issue obtained during initial rendering or after a series of operation in grid? 
4.       If you can’t reproduce the issue in above sample, please share the hosted link of your sample project. 

Regards, 
Ragavee U S. 


Loader.
Live Chat Icon For mobile
Up arrow icon