JavaScript 使用 bootstrap-table 时出错
JavaScript error using bootstrap-table
我正在尝试将 bootstrap-table 与 MVC 结合使用。我在脚本和内容中有以下文件:
bootstrap-table.js
bootstrap-table.min.js
bootstrap-table-locale-all.js
bootstrap-table-locale-all.min.js
bootstrap-table.css
bootstrap-table.min.css
然后我在 bundleconfig.cs 文件中使用以下内容:
bundles.Add(new ScriptBundle("~/bundles/bootstraptable").Include(
"~/Scripts/bootstrap-table*"));
bundles.Add(new StyleBundle("~/Content/bootstraptable").Include(
"~/Content/bootstrap-table*"));
“_Layout.cshtml”文件中的这些:
@Styles.Render("~/Content/bootstraptable")
@Scripts.Render("~/bundles/bootstraptable")
我也有 jQuery 和 Bootstrap 包括(和工作),所以我不认为这是一个依赖性问题。
当我 运行 项目时(在我尝试使用 table 做任何事情之前),我得到:
Unable to get property 'locales' of undefined or null reference
没有用于此的 NuGet 包,所以我不得不手动添加文件,所以我可能遗漏了什么。但是根据网站(http://bootstrap-table.wenzhixin.net.cn/getting-started/),看来我有我需要的东西。
有人遇到过这个问题或知道我做错了什么吗?
谢谢。
显然,捆绑包中的文件列表对此很重要。当我将它与通配符捆绑在一起时,它不起作用。当我把它切换到
bundles.Add(new ScriptBundle("~/bundles/bootstraptable").Include(
"~/Scripts/libs/bootstrap-table.js",
"~/Scripts/libs/bootstrap-table-en-US.js"));
明确地将 2 个必要的文件放入包中(我将 "all" 语言环境替换为我需要的那个),然后它就起作用了。
我正在尝试将 bootstrap-table 与 MVC 结合使用。我在脚本和内容中有以下文件:
bootstrap-table.js
bootstrap-table.min.js
bootstrap-table-locale-all.js
bootstrap-table-locale-all.min.js
bootstrap-table.css
bootstrap-table.min.css
然后我在 bundleconfig.cs 文件中使用以下内容:
bundles.Add(new ScriptBundle("~/bundles/bootstraptable").Include(
"~/Scripts/bootstrap-table*"));
bundles.Add(new StyleBundle("~/Content/bootstraptable").Include(
"~/Content/bootstrap-table*"));
“_Layout.cshtml”文件中的这些:
@Styles.Render("~/Content/bootstraptable")
@Scripts.Render("~/bundles/bootstraptable")
我也有 jQuery 和 Bootstrap 包括(和工作),所以我不认为这是一个依赖性问题。
当我 运行 项目时(在我尝试使用 table 做任何事情之前),我得到:
Unable to get property 'locales' of undefined or null reference
没有用于此的 NuGet 包,所以我不得不手动添加文件,所以我可能遗漏了什么。但是根据网站(http://bootstrap-table.wenzhixin.net.cn/getting-started/),看来我有我需要的东西。
有人遇到过这个问题或知道我做错了什么吗?
谢谢。
显然,捆绑包中的文件列表对此很重要。当我将它与通配符捆绑在一起时,它不起作用。当我把它切换到
bundles.Add(new ScriptBundle("~/bundles/bootstraptable").Include(
"~/Scripts/libs/bootstrap-table.js",
"~/Scripts/libs/bootstrap-table-en-US.js"));
明确地将 2 个必要的文件放入包中(我将 "all" 语言环境替换为我需要的那个),然后它就起作用了。