2016-04-20 49 views
0

我使用angularjs指令http://marceljuenemann.github.io/angular-drag-and-drop-lists/拖动&在页面上拖放东西。Angularjs指令拖放,需要添加列

我不知道这是否是最适合我需要的。

我已经重现演示

http://marceljuenemann.github.io/angular-drag-and-drop-lists/demo/#/nested

在小提琴

http://jsfiddle.net/5yogbajq/16/

我需要的是加在容器上更多的列。 我已经添加了第13项,并且它到底部和右侧。 我需要的是这个和右边的第9项和第12项在同一行。 类似于:

<tr> 
<td>item 9</td> 
<td>item 12</td> 
<td>item 13</td> 
</tr> 

任何帮助都会升值。

在此先感谢。

回答

1

作为默认,列类与50%的宽度,这代表了一个容器内2列的总空间限定,并且这就是为什么项目13中不期望的位置显示出来:

.dropzone .container-element .column { 
    float: left; 
    border-top: 1px dashed black; 
    border-bottom: 1px dashed black; 
    border-left: 1px dashed black; 
    border-right: 1px dashed black; 
    width: 50%; 
} 

如果你想你的容器2有3列,那么宽度应该是33333%。

要根据每个容器的列数使宽度动态的,你可以添加一个ng-style计算可用宽度:这里

<div class="container-element box box-blue"> 
    <h3>Container {{item.id}}</h3> 
    <div class="column" ng-style="{'width': 100/item.columns.length + '%'}" ng-repeat="list in item.columns" ng-include="'list.html'"></div> 
    <div class="clearfix"></div> 
</div> 

检查的变化:http://jsfiddle.net/bk36gazj/