如何在拖放 (DnD) 操作后获取增强网格列的新顺序

发布于 2024-10-04 08:41:33 字数 132 浏览 2 评论 0原文

我们正在寻找一种方法来在同一网格内进行一些列拖放操作后记录增强网格中的列顺序,因为网格的布局在 DnD 操作后不会改变,所以我找不到任何获取列序列的方法。 有什么直接的方法吗? 或者,我们是否有任何与 DnD 相关的事件,可以用来跟踪网格中的列顺序。

we were looking for a way to record the order of the columns in the enhanced grid after some column drag and drop operations within the same grid, since the layout of the grid does not change after a DnD operation, I am not able to find any way to obtain the sequence of columns.
Is there any direct way for this?
Or otherwise, do we have any events associated with DnD which one can use to keep track of sequence of columns in the grid.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

×纯※雪 2024-10-11 08:41:33
function getHeaderDetails(lookUpAttribute)
{
 //returns the attribute of the header cells in the order in which they are
 //for example dnd cols-lookUpAttribute="field"  returns the column field you would want -   //preferably unique identifiers of the column
  var currentColumnOrder=[];
  var i = 0, views = advancedGrid.views.views;
  for(; i < views.length; i++){
   cells = views[i].structure.cells;       
   for(var index=0 ; index<cells.length; index++){      
    if (cells[index])
    {
     for (var key in cells[index]  )
     {        
      var cellObject=cells[index][key];
      //if(this.grid.rowSelector){

      //first one is always the selection box column
      //TODO change the check condition if rowselector exist
      //if (key!=="0")
      //{
       currentColumnOrder.push(cellObject[lookUpAttribute]);
      //}                         
     }
    }       
   }
  }
  return currentColumnOrder;
}
function getHeaderDetails(lookUpAttribute)
{
 //returns the attribute of the header cells in the order in which they are
 //for example dnd cols-lookUpAttribute="field"  returns the column field you would want -   //preferably unique identifiers of the column
  var currentColumnOrder=[];
  var i = 0, views = advancedGrid.views.views;
  for(; i < views.length; i++){
   cells = views[i].structure.cells;       
   for(var index=0 ; index<cells.length; index++){      
    if (cells[index])
    {
     for (var key in cells[index]  )
     {        
      var cellObject=cells[index][key];
      //if(this.grid.rowSelector){

      //first one is always the selection box column
      //TODO change the check condition if rowselector exist
      //if (key!=="0")
      //{
       currentColumnOrder.push(cellObject[lookUpAttribute]);
      //}                         
     }
    }       
   }
  }
  return currentColumnOrder;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文