本文介绍了错误:Kendo“Something”不是一个功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我试图将我的纯HTML / Javascript网站(工作正常)转换为ASP MVC4项目。我所做的是获取和使用XML和XSLT进行转换。我最近使用代码来做到这一点

So I am trying to convert my plain HTML/Javascript site (which works fine) into an ASP MVC4 project. What I do is get and XML and use and XSLT to transform. I litreally use the code from here to do that

在我的 _Layout.cshtml 中,我使用razor加载资源

In my _Layout.cshtml I use razor to load the resource

<!DOCTYPE html>
<html>
<head>
<title>@ViewBag.Title</title>  
<meta http-equiv="content-type" content="text/html; charset=utf-8" />        
 ... things...
  @Scripts.Render("~/bundles/kendoScripts")
  @Scripts.Render("~/bundles/customScript") 
  @Styles.Render("~/Content/themes/Kendo")
  @Styles.Render("~/Content/themes/customCSS")   

我使用布局的视图非常直接,这就是页面中的全部内容

my view that uses the layout is very straight forward, this is all that is in the page

@using Summ.ExtensionCode
@model SumMVC.Models.SummaryModel
@{
  ViewBag.Title = "_Summary";
  Layout = "~/Views/Shared/_Layout.cshtml";
}

<div data-role="content">
@Html.RenderXml(Model.ProgramFilename, Model.StylesheetFilename, Model.Parameters)
</div>

@ Scripts.Render(〜/ bundles / customScript),是一个JS文件,renderpage.js,它有一些代码 $(this).kendoDropDownList(); 这是一个select元素。但我收到一个 .kendoDropDownList(); 不是函数的错误。来自firebug的错误: TypeError:$(...)。kendoDropDownList不是函数和来自GoogleChrome的错误未捕获TypeError:Object [object Object ]没有方法'kendoDropDownList'。似乎在我的包中JS文件kendo.all.min.js没有开始加载这里看起来像

In @Scripts.Render("~/bundles/customScript"), is a JS file, renderpage.js that has this bit of code $(this).kendoDropDownList(); where this is a select element. But I am getting a error that .kendoDropDownList(); is not a function. The error from firebug: TypeError: $(...).kendoDropDownList is not a function and the errror from GoogleChrome Uncaught TypeError: Object [object Object] has no method 'kendoDropDownList'. It seems that in my bundle the JS file kendo.all.min.js is not begin loaded here is what is looks like

bundles.Add(new ScriptBundle("~/bundles/kendoScripts")
            .Include("~/Scripts/kendoui/kendo.web.min.js")
            .Include("~/Scripts/kendoui/kendo.all.min.js")
            );

....
bundles.Add(new ScriptBundle("~/bundles/customScript")
           .....
            .Include("~/Scripts/SummaryScript/renderpage.js")
             ....                       
            );

我假设在kendo.all.min.js完成加载之前可能正在执行代码,但正如你在上面看到的renderpage.js是在剑道之后。任何想法或见解?

I am assuming that perhaps the code is being executed before kendo.all.min.js is done loading, but as you can see above renderpage.js is after kendo. Any ideas or insight?

更新

我手动加载资源时忘记添加head标签中的MVC项目

I forgot to add that when I manually load the resource in the MVC project in the head tag

<script type="text/javascript" src="~/Scripts/kendoui/kendo.web.min.js"></script>       
<script type="text/javascript" src="~/Scripts/kendoui/kendo.all.min.js"></script>
....
<script type="text/javascript" src="~/Scripts/ExecSummaryScript/renderpage.js"></script>

一切正常。

Update2

原来没有加载Kendo JS文件。我检查开发控制台中的资源并注意到它甚至没有。仔细检查我发现除了一些 .min.js 文件之外,所有资源都已加载。有一些已加载,但有些未加载的是jquery-ui-1.10.3.min.js和jquery.browser.min.js。

Turns out the Kendo JS file is not being loaded at all. I check the resource in the dev console and notice that it not even there.Upon closer inspection I notice that all resources are loaded except some .min.js files. There are a few loaded but some that are not loaded are jquery-ui-1.10.3.min.js, and jquery.browser.min.js.

推荐答案

我知道这将是一件愚蠢的事。事实证明,这是一个MVC4 gothcha。我不得不重命名我的文件。显然它不喜欢扩展名为 min.js的文件

I knew it was going to be something stupid. Turns out that it's a MVC4 gothcha. I had to rename my file. Appearently it did not like files with extension min.js I found the answer here

这篇关于错误:Kendo“Something”不是一个功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 11:07