The file needed to load the chart JS is being loaded AFTER the the .igDataChart is being called. I get the null reference exception before I see "http://cdn-na.infragistics.com/jquery/20122/latest/js/modules/infragistics.ui.chart.js" being loaded and it is becoming a source of immense frustration
This is the code I am using to render out the page. The "Scripts" section is rendered into the head tag
Attempts @(Html.Infragistics().DataChart(Model.AttemptHistory.AsQueryable()) .ID("attemptChart") .Width("768px") .Height("242px") .VerticalZoomable(true) .HorizontalZoomable(true) .Legend(l => l.ID("attemptLegend")) .Axes(ax => { ax.CategoryX("Date").Label(d => d.Date); ax.NumericY("Value").Label(v => v.Value); }) .Series(s => { s.Column("seriesAttempts") .Title("Attempts") .XAxis("Date").YAxis("Value") .ShowTooltip(true) .TooltipTemplate("tooltipTemplate"); }).DataBind().Render() ) Total: @Model.TotalAttempts
@section Scripts { // Value: ${item.Open} // ]]> @Html.Infragistics().Loader().Resources("igDataChart.Category").Render() }
In the head tag
@Html.Infragistics().Loader().ScriptPath("http://cdn-na.infragistics.com/jquery/20122/latest/js/").CssPath("http://cdn-na.infragistics.com/jquery/20122/latest/css/").Render()
Well it would appear that formatting is lost...I'm not sure how to preserve code formatting. I've been looking at this sample over and over again and I appear to be doing almost verbatim what is written down and yet I'm getting .igDataChart is undefined. What am I doing wrong?
this is likely due to the bundling in MVC4. By default it loads the jquery bundle at the end of the body. If you loaded it in the head, and then our components, then when it loads again at the end of the body (or a second time in the head) it will cause our jQuery extensions to become undefined.
Check your templates to see what the timing is of when the jQuery bundle is loaded.
Hello Steve,
I have been looking into your code snippets still I am not sure what may cause the mentioned issue.
Could you provide me with a small sample where this is reproducible so I can investigate it further.
Thanks in advance.
This is what is inside my head tag
<script src="http://code.jquery.com/jquery-1.8.3.js"></script> <script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script> <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script> <script src="http://cdn-na.infragistics.com/jquery/20122/latest/js/infragistics.loader.js"></script> <link href="@Url.Content("~/Content/jQuery-UI/jQuery-UI.css")" rel="stylesheet" type="text/css" /> @Html.Infragistics().Loader().ScriptPath("http://cdn-na.infragistics.com/jquery/20122/latest/js/").CssPath("http://cdn-na.infragistics.com/jquery/20122/latest/css/").Render() @RenderSection("Scripts", false)
I am just checking have you been able to resolve your issue? If you still need any assistance on the matter do not hesitate to ask.
I have been looking into your snippets and I am not sure what may cause the mentioned issue on your side. Please make sure that you define the following scripts before you reference the @Html.Infragistics().Loader():
<!-- Required JavaScript Files for using Infragistics jQuery UI-based widgets with the Infragistics Loader --> <script src="@Url.Content("~/Scripts/modernizr-1.7.js")"></script> <script src="@Url.Content("~/Scripts/jquery-1.5.1.js")"></script> <script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.js")"></script> <!-- This script reference is require by the Infragistics Loader rendered below --> <script src="@Url.Content("~/Infragistics/js/infragistics.loader.js")"></script>
Also you can try to create a new IgNiteUI starter project which will include all of these scripts for you.
Please let me know if this helps.