亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用 ngx-sortablejs 將列拖放到表中的另一行

使用 ngx-sortablejs 將列拖放到表中的另一行

胡子哥哥 2023-05-11 14:47:04
我試圖將一行的列拖到另一行,但它不能拖放到另一行的列數組。我有以下類型的數組(示例數據數組)。[ { // row    key: value,      cols: [{ key: value }] // cols array   },  //n numers of row]我的代碼。<table id="id">    <tbody sortablejs ngDefaultControl [(ngModel)]="Array">        <tr *ngFor="let item of Array; let i = index">            <td class="myRowClass sort-disabled">                <!-- index logic -->            </td>            <td class="myRowClass sort-disabled">                <!--logic -->            </td>            <td sortablejs>                <div *ngFor="let cell of item.cols" class="divSize">                    <!-- column logic -->                </div>            </td>        </tr>    </tbody></table>
查看完整描述

1 回答

?
揚帆大魚

TA貢獻1799條經驗 獲得超9個贊

通過使用[sortablejsOptions]="options"我實現了我的功能。


<table id="id">

 <tbody [sortablejs]="Array" [sortablejsOptions]="Array">

  <tr *ngFor="let item of Array">

   <td class="myRowClass sort-disabled">

    <!-- index logic -->

   </td>

   <td>

    <!--row logic -->

   </td>

   <td [sortablejs]="item.cols" [sortablejsOptions]="options">

    <div *ngFor="let cell of item.cols; let j = index">

     <!--column logic -->

    </div>

   </td>

  </tr>

 </tbody>

</table>

.ts 文件組名中的選項必須相同。


options: Options = {

    group: { name: "test" }

}


查看完整回答
反對 回復 2023-05-11
  • 1 回答
  • 0 關注
  • 186 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號