Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
角度数据绑定到表,可能使用jQuery sortable_Jquery_Angularjs - Fatal编程技术网

角度数据绑定到表,可能使用jQuery sortable

角度数据绑定到表,可能使用jQuery sortable,jquery,angularjs,Jquery,Angularjs,我正在尝试将双向数据绑定(我认为)到一个表,因此在我对其进行排序时,它将更新索引——我目前正在使用jQuery sortable来实现这一点。当然,我对其他选择持开放态度 我在用,好像很老了。所以我尝试着做一些类似的事情,因为这是想要的效果。最大的区别是我使用jQuery UI而不是angular UI(也许这就是它不能正常工作的原因)。但根据小提琴,这里是我的基本设置: <form id="lessonInstructionPlan" class="lessonItem" ng-cont

我正在尝试将双向数据绑定(我认为)到一个表,因此在我对其进行排序时,它将更新索引——我目前正在使用jQuery sortable来实现这一点。当然,我对其他选择持开放态度

我在用,好像很老了。所以我尝试着做一些类似的事情,因为这是想要的效果。最大的区别是我使用jQuery UI而不是angular UI(也许这就是它不能正常工作的原因)。但根据小提琴,这里是我的基本设置:

<form id="lessonInstructionPlan" class="lessonItem" ng-controller="instructionController">
    <div class="small-12 columns ">
        <div class="saInstPlanHead">
            <h5>Instructional Plan</h5>
        </div>
        <div class="lessonSASlider">
        <div class="row rowFix">

        <div class="small-12 columns text-right saInstrcutionTableCover">
            <div class="row rowFix">
                <div class="small-12 columns lessonItemHeader">
                    <h3>Manage</h3>
                </div>
            </div>
            <div class="row rowFix">
                <div class="hide-for-small medium-12 columns smallCover">
                <!-- Medium -large table -->
                <table class="saInstrcutionTable" cellspacing="0">
                    <thead>
                        <tr>
                            <th></th><th></th><th>Sub Level</th><th>Targets</th><th>Instructions</th><th>Response</th>
                        </tr>
                    </thead>
                    <tbody class="sortEmPls" ng-model="listTable">

                        <tr ng-repeat="item in listTable">
                            <td class="moveTableLevel"><div class="saTableUp"></div><div class="saTableDown"></div></td><td><input type="checkbox"></td><td>1. {{ $index }} </td><td>{{item}}</td><td>{{item}}</td><td>{{item}}</td>
                        </tr>

                    </tbody>
                </table>    
                <!-- End Medium -large table -->

我只是在
.sortEmPlease
上调用jQuery sortable,它是表体。它工作得很好,但它似乎不能根据位置双向绑定和更新索引。

我想向您推荐一件小事。永远不要用angularjs尝试jquery ui。但是,如果您想使用jquery,则必须通过创建指令来管理它。之所以需要这些指令,是因为当路由发生变化时,DOM是如何被替换的。它用直接从服务器缓存的内容替换DOM,而不是上次查看路由时删除的内容的呈现版本。这意味着每次路由更改时,您都需要运行jQuery UI函数来初始化jQuery UI小部件。啊,谢谢,我现在只是在胡乱处理选项,但我需要某种方式来上下移动表行,如果他们根据自己的索引更新自己的号码,那就太好了。我建议你用angularjs编写一个自定义过滤器,并在那里写下你想做的任何事情:)谢谢!!我来看看这个。
.controller('instructionController', function($scope){

     $scope.listTable = ["one", "two", "thre", "four", "five", "six"];

 })