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
680
Object doesn't support property or method 'igGrid' on refresh
posted

I've got an ASP.NET MVC 4 app using igGrid. When the page first comes up, it works fine. If I refresh the page, I get the error:

 

Microsoft JScript runtime error: Object doesn't support property or method 'igGrid'

 

In the F12 developer tools, all the scripts seem to be loaded, so my guess is something's not happening in the proper order.

 

In my _Layout.cshtml, I have:

 

    <script type="text/javascript">     $.ig.loader({         scriptPath: '@Url.Content("~/Scripts/")',         cssPath: '@Url.Content("~/Content/")',         resources: 'igTree,igGrid'     });</script>   

 

In the .cshtml of the page with the problem, I simply have:

 

@using Infragistics.Web.Mvc;  @model GEMS.Web.Models.MedicalProcedurePriceMaintModel @{     ViewBag.Title = "Index"; } <h2>Medical Procedure Price Maintenance</h2>

@(Html.Infragistics().     Grid<GEMS.Web.Business.Contracts.IMedicalItemPrice>().     Columns(column=>         {             column.For(x => x.WarehouseCode).HeaderText("Warehouse").Width("70px");             column.For(x => x.Item).HeaderText("Item").Width("150px");             column.For(x => x.Description).HeaderText("Description").Width("200px");             column.For(x => x.Price).HeaderText("Price").Width("50px").Format("C");         }).     ID("grid").     DataSourceUrl(Url.Action("BindGridFiltering")).     Width("500px").     DataBind().     Render())

 

BTW, it'd be nice if you guys had code tags for your HTML editor so this stuff would actually format (or if you have them, make it more obvious where they are).

Parents
No Data
Reply
  • 23953
    Verified Answer
    Offline posted

    Hi,

    Mixing JavaScript loader code with Infragistics MVC Wrapper is not supported scenario. The reason is that the Infragistics MVC Wrapper checks where there is Loader MVC Wrapper code. In case there is the generate code on the client looks like this:

    $.ig.loader("igGrid.Paging.Sorting", function(){/*igGrid initialization code here*/});

    Otherwise the code looks like this:

    $(function() {/*igGrid initialization code here*/});

    In your case there is an absence of Loader MVC Code so the generated code will be the later which causes the error you're observing.

    The fix for your issue is to put  Loader MVC Wrapper in the View.

     

    Hope this helps,

    Martin Pavlov

    Infragistics, Inc.

Children