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).
My guess is, for some reason, the ig.loader stuff isn't getting called before the grid (but the problem goes away if I put a breakpoint on the ig.loader code, so I'm not sure). Oddly, while the original problem goes away when I set the breakpoint, it instead gives me a "no such widget loaded" for igGridSelection (which, since my original post has been added to the resources in the ig.loader).
I still don't have a solution to this problem. I can't refresh my page without getting this error and, occasionally, when the page first comes up, I get the error, but most of the time, when it first comes up it works fine.