jtable ссылки не загружаются с MVC 4 asp.net

0

Я не могу понять ошибку jquery из-за того, что я новичок.

Я получаю эту ошибку

"$ не определено", когда я не добавляю ссылки на мои jquery и jquery ui libraries
И когда я добавляю ссылки jquery и jquery -ui, я получаю еще одну ошибку, например "read not defined" в jtable.site.js и jquery.jtable.js

Поэтому я делюсь файлом макета, а также файлом пакетов. Пусть кто-нибудь проверяет, в чем проблема. Вот мой файл макета

<!DOCTYPE html>

@{
var jTableStyle = "metro/red/jtable.css";
if (!string.IsNullOrEmpty(Request["jTableStyle"]))
{
    jTableStyle = Request["jTableStyle"];
}
 }


 <html lang="en">
 <head>
<meta charset="utf-8" />
<title>@ViewBag.Title - myEMR Application</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width" />
 <script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.20.min.js")"></script>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")

 <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/themes/redmond/jquery-ui-1.8.16.custom.css")" 
    rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/highlight.css")" rel="stylesheet" 
     type="text/css" />
    <link href="@Url.Content("~/Scripts/jtable/themes/" + jTableStyle)" 
    rel="stylesheet" type="text/css" />

    <link href="@Url.Content("~/Scripts/syntaxhighligher/styles/shCore.css")" 
    rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Scripts/syntaxhighligher/styles/shThemeDefault.css")"
     rel="stylesheet" type="text/css" />

    @RenderSection("CssImport", false)


    <script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" 
     type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/syntaxhighligher/shCore.js")"
   < type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/syntaxhighligher/shBrushJScript.js")"
      type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/syntaxhighligher/shBrushXml.js")" 
     type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/syntaxhighligher/shBrushCSharp.js")" 
     type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/syntaxhighligher/shBrushSql.js")" 
    type="text/javascript"></script>




    <script src="@Url.Content("~/Scripts/jtablesite.js")"type="text/javascript">
    </script>

    <script type="text/javascript" src="@Url.Content("~/Scripts/jtable    
    /jquery.jtable.js")"></script> 
    @RenderSection("JavascriptImport", false)    
         <div id="body">
    @RenderSection("featured", required: false)
    <section class="content-wrapper main-content clear-fix">
        @RenderBody()
    </section>

        @Scripts.Render("~/bundles/jquery")
       @Scripts.Render("~/bundles/jqueryui")
        @RenderSection("scripts", required: false)


И мой файл связок

  public class BundleConfig
{
    // For more information on Bundling, visit http://go.microsoft.com/fwlink
    /?LinkId=254725
    public static void RegisterBundles(BundleCollection bundles)
    {
        bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                    "~/Scripts/jquery-{version}.js"));

        bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
                    "~/Scripts/jquery-ui-{version}.js"));

        bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                    "~/Scripts/jquery.unobtrusive*",
                    "~/Scripts/jquery.validate*"));

        // Use the development version of Modernizr to develop with and learn from.
        Then, when you're
        // ready for production, use the build tool at http://modernizr.com to pick
         only the tests you need.
         bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                    "~/Scripts/modernizr-*"));

        bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));

        bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
                    "~/Content/themes/base/jquery.ui.core.css",
                    "~/Content/themes/base/jquery.ui.resizable.css",
                    "~/Content/themes/base/jquery.ui.selectable.css",
                    "~/Content/themes/base/jquery.ui.accordion.css",
                    "~/Content/themes/base/jquery.ui.autocomplete.css",
                    "~/Content/themes/base/jquery.ui.button.css",
                    "~/Content/themes/base/jquery.ui.dialog.css",
                    "~/Content/themes/base/jquery.ui.slider.css",
                    "~/Content/themes/base/jquery.ui.tabs.css",
                    "~/Content/themes/base/jquery.ui.datepicker.css",
                    "~/Content/themes/base/jquery.ui.progressbar.css",
                    "~/Content/themes/base/jquery.ui.theme.css"));
    }

И snap-снимок каталога скриптов Изображение 174551

И мой подробный каталог Изображение 174551

Теги:
asp.net-mvc-4
visual-studio-2012
jquery-jtable

2 ответа

1

на самом деле я делал небольшую ошибку, ошибка была в файле представления контроллера, где jtable инициализируется, я использовал

$ (Документ).read
И на самом деле это $ (документ). Уже сейчас он работает.

1

На первый взгляд, похоже, что вы ссылаетесь на файл jtablesite.js, прежде чем вводить библиотеку jtable. Вам нужно объявить теги скриптов в порядке наследования, то есть включить фактическую библиотеку jtable, прежде чем вы введете какие-либо пользовательские/вызовы в библиотеку jtables.js.

  • 0
    Нет, у меня есть файл jtablesite.js в моей директории скрипта, пожалуйста, смотрите внимательно
  • 0
    Вы должны обновить свое изображение, чтобы показать весь каталог скриптов. Кроме того, пожалуйста, смотрите мое обновление после дальнейшего просмотра вашей разметки HTML
Показать ещё 3 комментария

Ещё вопросы

Сообщество Overcoder
Наверх
Меню