Angular2 + Ag

编程入门 行业动态 更新时间:2024-10-08 06:22:07
本文介绍了Angular2 + Ag-grid-是否可以通过按钮上下移动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的ag-grid数组有问题,我有这个数组:

I have a problem with my ag-grid array, I have this array :

<div style="width: 100%;"> <ag-grid-angular #agGrid style="width: 100%; height: 200px;" class="ag-fresh" [gridOptions]="gridOptions" [rowData]="rowData" [columnDefs]="columnDefs" enableColResize rowSelection="multiple" (columnResized)="onColumnEvent($event)" (columnPinnedCountChanged)="onColumnEvent($event)"> </ag-grid-angular> </div>

我有两个按钮:

<div class="bouton" placement="top" ngbTooltip="Déplacer instruction vers le haut"> <button (click)="moveUp()"> <img src="/src/images/flechehaut.png" style="width:60px;height:60px;" /> </button> </div> <div class="bouton" placement="top" ngbTooltip="Déplacer instruction vers le bas"> <button (click)="moveDown()"> <img src="/src/images/flechebas.png" style="width:60px;height:60px;" /> </button> </div>

我想知道是否可以通过向上移动整行按钮,然后使用我的下移按钮向下移动一行。 我查看了 ag -grid文档,但没有发现这种可能性。

And I was wondering if it was possible to move up an entire row with my move up button and to move down a row with my move down button. I looked on the ag-grid documentation but found nothing about this possibility.

至少有可能吗?如果是的话,我应该如何看待这个问题?

Is it at least possible ? And if it is, how should I look into this problem ?

推荐答案

是的,我可以想到两种可能性:

Yes, I can think of two possibilities:

  • 重新排列rowData并将其重新加载到网格中
    • 这可能会变得很昂贵取决于您有多少行
    • 我当然希望您已对所有列禁用排序,否则您的 moveUp 和 moveDown 函数将毫无用处
    • Rearrange the rowData and reload it in the grid
      • This may get costly depending on how many rows you have
      • I sure hope you have sorting disabled on all your columns, otherwise your moveUp and moveDown functions would be useless
        • 这将使rowData的顺序与最初发送到网格时的顺序相同,但以特定顺序显示。
        • 我认为可能有可能隐藏此额外的列,并且仍将其保留在所述列上。
  • 更多推荐

    Angular2 + Ag

    本文发布于:2023-11-23 00:53:08,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1619525.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:Ag

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!