I have an ASP.NET MVC 4 web application. On a web page, I have a HTML table presenting a number of items.
I want to be able to implement drag and drop re-ordering for the table of items, which is saved back to the data model.
I've looked at and tried a few different methods for doing this, using JQuery UI and some other plugins but I haven't successfully been able to implement the functionality.
I've looked at this example, but my table didn't change on running it after implementing it as follows:
<script type="text/javascript">
$(document).ready(function()
{
$('#clueTable tbody').sortable().disableSelection();
});
</script>
I have all the necessary javascript:
<script type="text/javascript" src="~/Scripts/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="~/Scripts/jquery-ui-1.10.2.min.js"></script>
I'm not going to post the whole table, but it looks something like this:
<table id="clueTable" class="grid">
<thead>
<tr>
<th>Clue #</th>
<th>Location</th>
<th>Quiz Clue?</th>
<th>Actions</th>
</tr>
</thead>
@for (int i = 0; i < Model.Clues.Count; i++)
{
<tbody>
<tr>
<td>Number</td>
<td>Things</td>
<td>Yes</td>
<td>Stuff</td>
</tr>
</tbody>
}
</table>
tbodyaround everytr? There should be only onetbody(if any).