Lasse Edsvik
Lasse Edsvik

Reputation: 9298

Kendo UI sortable table

I'm having problems getting Kendo UI sortable to work on a table.

Code:

<table class="table table-bordered table-striped" id="test-table">
<tr>
    <th colspan="2">Headline</th>           
</tr>       
<tr>
     <td>Test 1</td>
     <td>A</td>
</tr>
<tr>
     <td>Test 2</td>
     <td>B</td>
</tr>
</table>
<script>
    $(function())
      $("#test-table").kendoSortable();
</script>

When I try to sort it looks like I'm only dragging one td-tag, and no sortable what so ever.

Upvotes: 3

Views: 721

Answers (1)

calinaadi
calinaadi

Reputation: 1466

You should apply also a filter to kendoSortable to point to tr.

  <div id="wrapper">
    <table class="table table-bordered table-striped" id="test-table">
        <thead>
            <tr>
                <th colspan="2">Headline</th>           
            </tr>
        </thead>
        <tbody>
            <tr>
                 <td>Test 1</td>
                 <td>A</td>
            </tr>
            <tr>
                 <td>Test 2</td>
                 <td>B</td>
            </tr>
        </tbody>
    </table>
</div>

<script>
    $("#test-table").kendoSortable({
         container: $("#wrapper"),
         filter: ">tbody >tr"
    });
</script>

Upvotes: 3

Related Questions