未被捕获的TypeError:$(…).tableDnD不是函数 - javascript

实际上,我正在尝试使用c#开发一个拖放式gridview,我正在寻找一些诸如tableDnD之类的jquery库,并在下面的示例中看到了一段代码。我正在尝试用我的代码回复它,但是我有一个

Uncaught TypeError: $(...).tableDnD is not a function.

我的代码很简单,我想解释一下:

首先,这是具有以下代码的母版页:

<head runat="server">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
   <title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/themes/smoothness/jquery-ui.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js"></script>
<link rel="stylesheet" href="Styles/Coaching.css" type="text/css" />
  <!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"/>

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous"/>

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<script src="http://localhost:2848/js/jquery.tablednd.js" type="js/javascript">
</script>

 <script type="text/javascript">
    var strorder;
    $(document).ready(function () {
       $('#grdResultados').tableDnD(
       {
           onDrop: function (table, row) {
               reorder();
               $.ajax({
                   type: "POST",
                   url: "diagnostico-plantilla.aspx/GridViewReorders",
                   data: '{"Reorder":"' + strorder + '"}',
                   contentType: "application/json; charset=utf-8",
                   dataType: "json",
                   async: true,
                   cache: false,
                   success: function (msg) {
                       alert("Successfully Save ReOrder");
                   }

               })
           }
       }
       );
   });
   function reorder() {
       strorder = "";
       var totalid = $('#grdResultados tr td input').length;
       for (var i = 0; i < totalid; i++) {
           strorder = strorder + $('#grdResultados tr td input')[i].getAttribute("value") + "|";
       }
   }
</script>

如您所见,这是一个简单的母版页,那么aspx在这一行中我编写了gridview

 <asp:GridView ID="grdResultados" runat="server" CssClass="table table-hover" AllowPaging="True" 
                            AllowSorting="True" AutoGenerateColumns="False" GridLines="None" DataKeyNames="id" DataSourceID="odsResultados" OnRowDataBound="grdResultados_RowDataBound" OnPageIndexChanged="grdResultados_PageIndexChanged" OnSorting="grdResultados_Sorting" OnRowCommand="grdResultados_RowCommand">

所以,为什么会有这个错误,因为当我尝试进行拖放操作时,它不起作用,并且我使用了Chrome检查器,并且遇到了这个问题。

非常感谢

javascript大神给出的解决方案

替换此行:

<script src="http://localhost:2848/js/jquery.tablednd.js" type="js/javascript">

有了这个:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jqgrid/4.6.0/plugins/jquery.tablednd.js"></script>

如果这解决了问题,则说明您未正确引用tablednd.js文件。将引用添加到本地.js文件的最简单方法是将其从Visual Studio-Solution Explorer拖动到页面。

Mongo汇总 - javascript

我的收藏中有以下文件{ "_id": ObjectId("54490b8104f7142f22ecc97f"), "title": "Sample1", "slug": "samplenews", "cat": …

PHP stringID无法从回显中读入onclick - javascript

我有一个音频播放器,可以在HTML中正常工作,但是当我从PHP回显调用时,似乎没有得到div ID的名称,因此它无法播放我的音频。这是我的代码:// Show audio if ($sObj->get('audio') != null) { $sAudio = $sObj->get('audio'); $a…

如果复选框切换复选框已选中,则在切换div中输入必填字段 - javascript

我使用脚本用JavaScript切换了一些div。如果要选中复选框以显示toogle div,我想在toogle div中设置一些“必填”输入字段。有人能弄清楚吗?那是工作吗?function show(id) { if(document.getElementById) { var mydiv = document.getElementById(id); m…

在php中单击按钮添加表行并设置字段值 - javascript

我有一个表单,必须在单击按钮时添加表行。这是我必须动态添加的表行:(addProdToGroup.php)<tr style="text-align: center;" id="products"> <td><?php $j ?></td> <td><s…

淘汰赛在金字塔中的行为不正确 - javascript

我正在使用Pyramid构建一个Webapp,但是Knockout的行为有所不同。我有一个表格: <div data-bind="with: $root.itemToAdd" style="display: none;"> <form data-bind="submit: $root.add…