4 years ago

jquery sortable table

Posted 4 years ago by jbowman99

I have a foreach loop running over an array passed to a view, displayed in a table. I am trying to use jquery sortable so the order of the rows can be sorted manually by the user. table looks like this:

<div class="section-jobs" style="width: 45%; float: left;">
        <h5>Jobs for Specials Section</h5>
        <table id="sortable" class="table table-bordered table-striped">
                    <th>Start Date</th>
                    <th>End Date</th>
                @foreach($sectionJobs as $job)
                        <td>{!! $job->title !!}</td>
                        <td>{!! $job->description !!}</td>
                        <td>{!! $job->start_date !!}</td>
                        <td>{!! $job->end_date !!}</td>

simple script looks like this:

$(function() {
            $( "#sortable" ).sortable();
            $( "#sortable" ).disableSelection();

the script works if I use an unordered list and line items but as a table it doesn't? followed the docs and can't work out why it's not working

any thoughts?


Please sign in or create an account to participate in this conversation.