Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
Unable to get property '_injectGrid' of undefined or null reference
posted

We are upgrading the jquery versions to the latest for an ownapplication code.

On upgrading to jquery 3.4.1, the grid is not loading for the machine level application and is failing in infragistics.ui.grid.framework.js with the below error :

 

0x800a138f - JavaScript runtime error: Unable to get property '_injectGrid' of undefined or null reference

0x800a138f - JavaScript runtime error: Unable to get property 'locale' of undefined or null reference

 

Following this error, the grid on the page is not loading.

Code snippet- html code

We are upgrading the jquery versions to the latest for the PAMS application code to cover the VAT findings.

On upgrading to jquery 3.4.1, the grid is not loading for the machine level application and is failing in infragistics.ui.grid.framework.js with the below error :

 

 

0x800a138f - JavaScript runtime error: Unable to get property '_injectGrid' of undefined or null reference

0x800a138f - JavaScript runtime error: Unable to get property 'locale' of undefined or null reference

 

Following this error, the grid on the page is not loading.

HTML CODE : 

<div style="clear: both;">
@(Html.Infragistics().Grid<AgentEvent>().ID("eventsGrid")
.Width("100%").Caption("Agent Events")
.Columns(x =>
{
x.For(y => y.TimeStamp).Width("15%").HeaderText("Date").Format("yyyy-MM-dd HH:mm").DataType("date");
x.For(y => y.EventId).Width("8%").HeaderText("Event ID");
x.For(y => y.Message).Width("auto").HeaderText("Message");
})
.Features(f =>
{
f.Paging().PageSizeDropDownLocation("inpager").PageSize(10);
f.Resizing();
})
.DataSourceUrl(Url.Action("AgentEventData", new { id = Model.Agent.Id }))
.DataBind().Render())
</div>

ERROR : Unable to get property '_injectGrid' of undefined or null reference in nfragistics.ui.grid.framework.js 

Could you please help me out on this?

Parents
No Data
Reply
  • 0
    Offline posted

    The issue arise when js/jquery is not able to refer to the element. It is because at the time of rendering the page(view), object is null or undefined - which means that there is no instance of a class in the variable. If you are getting data for object from an async call(api's), these kind of problems will arise. So you should always check the object whether it is null or undefined then if it is not, you can access its properties.

    The standard way to catch null and undefined simultaneously is this:

    if (variable == null) {
    // your code here.
    }

    Because null == undefined is true, the above code will catch both null and undefined.

    Also you can write equivalent to more explicit but less concise:

    if (variable === undefined variable === null) {
    // your code here.
    }

    This should work for any variable that is either undeclared or declared and explicitly set to null or undefined.

    In most cases it is related to getElementById(). So getting a value from an input could look like this:

    var value = document.getElementById("frm_new_user_request").value

    Also you can use some JavaScript framework, e.g. jQuery, which simplifies operations with DOM (Document Object Model) and also hides differences between various browsers from you.

    Getting a value from an input using jQuery would look like this:

    input with ID "element": var value = $("#element).value
    input with class "element": var value = $(".element).value

Children
No Data