2015-01-16 19 views
1

我試着在表中拖放行 - angularjs。我當前的代碼是在jsfiddle中拖放表的行不起作用 - angularjs

<div ng:controller="controller"> 
    <table style="width:auto;" class="table table-bordered"> 
     <thead> 
      <tr> 
       <th>Index</th> 
       <th>Count</th> 
      </tr> 
     </thead> 
     <tbody ui:sortable ng:model="list"> 
      <tr ng:repeat="item in list" class="item" style="cursor: move;"> 
       <td>{{$index}}</td> 
       <td>{{item}}</td> 
      </tr> 
     </tbody>{{list}} 
     <hr> 
</div> 
<script src="http://code.angularjs.org/1.0.2/angular.min.js"></script> 
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui/0.4.0/angular-ui.min.js"></script> 

我的控制器代碼是

var myapp = angular.module('myapp', ['ui']); 

myapp.controller('controller', function ($scope) { 
    $scope.list = ["one", "two", "thre", "four", "five", "six"]; 
}); 

angular.bootstrap(document, ['myapp']); 

它在http://jsfiddle.net/xfmh6ywm/運作良好,但在http://jsfiddle.net/9z4zn9uz/不相同的代碼工作。即使在我的網站中,與後者的小提琴類似,我無法重新排列行。

+1

我改變了你的小提琴的jQuery 1.8.3使用jQuery UI 1.9.2和它的作品.. – Nick

回答

-2

將jQuery版本從左上角的下拉菜單更改爲:jQuery 1.8.3 這將開始工作。

updated fiddle: 

http://jsfiddle.net/9z4zn9uz/1/

+0

能否請您說明理由一DOWN VOTE .. :) – Vijay

+0

正因爲如此,我嘗試將第一行從頂部移動到底部,但無法正常工作(瀏覽器:Chrome版本41.0.2272.101米) – ionat