-1
我使用jQuery UI排序,使我的表網格排序。但是我的元素仍然沒有重新排序,也沒有顯示錯誤。我從來沒有在asp.net mvc中使用過這種方法。jQuery的排序功能不工作視圖(mvc)
會很高興收到一些指導,謝謝。
<script type="text/javascript">
$('td, th', '#MenuItem').each(function() {
var cell = $(this);
cell.width(cell.width());
});
$('#MenuItem tbody').sortable().disableSelection();
<table id = "MenuItem" class="promo full-width alternate-rows" style="text-align: center;">
<tr>
<th>Prode Code
</th>
<th>ProdeTemplate
</th>
<th>Description <!-- JACK EDIT -->
</th>
<th>Action</th>
</tr>
<tbody>
@foreach (var item in Model.IndexListitem)
{
<tr>
<td class="center-text">
@Html.DisplayFor(modelItem => item.ProductCode)
</td>
<td>
@Html.DisplayFor(modelItem => item.ProdeTemplate.Description)
</td>
<td>
@Html.DisplayFor(modelItem => item.Description)
</td>
<td class="center-text nowrap">
@Html.ActionLink(" ", "Edit", new { id = item.ProdeID }, new { title = "Edit", @class = "anchor-icon-no-text edit" })
@Html.ActionLink(" ", "Details", new { id = item.ProdeID }, new { title = "Details", @class = "anchor-icon-no-text details" })
@Html.ActionLink(" ", "Delete", new { id = item.ProdeID }, new { title = "Delete", @class = "anchor-icon-no-text delete" })
</td>
</tr>
}
</tbody>
</table>
嘗試把'$( '#菜單項TBODY')排序()disableSelection();'[文檔中。準備](https://learn.jquery.com/using-jquery-core/document-ready/) – Knu8
感謝它的工作 – user5813072
你能接受我的回答:) – Knu8