2014-10-29 49 views
0

Ignite UI boilerplate将所有JavaScript文件加载到页面顶部。这符合everyotherexample我可以在Infragistics网站上找到。我可以将Ignite UI脚本放在页面底部吗?

我想加载这些文件在页面的底部,而不是。然而,当我尝试这样做,我得到一个JavaScript错误:

ReferenceError: $ is not defined 

在视图,我用的是网格的HTML帮助像这样(简化):

@model IQueryable<Product> 

@(Html.Infragistics().Grid(Model).DataBind().Render()) 

这对产生以下输出页:

<table id="Grid1"></table> 
<script type="text/javascript">$(function() {$('#Grid1').igGrid({ ... });</script> 

如果我能告诉的Infragistics把script标签页面的底部,我加载了jQuery,jQuery UI的,等以后,一切都将是桃色的。有没有办法可以做到这一点,仍然使用HTML助手?

回答

0

您可以使用Infragistics Loader查阅JavaScript资源。

在CSHTML你将有:

<script src="Scripts/infragistics.loader.js" type="text/javascript"></script> 

而在另一个脚本标签,您将具备以下条件:

$.ig.loader({ 
scriptPath: '{IG Resources root}/js/', 
cssPath: '{IG Resources root}/css/'}); 

$.ig.loader('igGrid.Paging.Updating', 
    function() { 
    // Create a couple of igGrids 
     $("#grid1").igGrid({ 
     virtualization: false, 
     autoGenerateColumns: true, 
     jQueryTemplating: false, 
    // and other} 

了解更多关于此这里:http://help.infragistics.com/Help/Doc/jQuery/2013.1/CLR4.0/html/Deployment_Guide_JavaScript_Resources.html#referencing_resources

+0

这是假设,我会不是使用HTML助手,对吧? – 2014-10-29 16:30:38