【问题标题】:How to get the new order for enhanced grid columns after a Drag and Drop(DnD) operation如何在拖放(DnD)操作后获得增强网格列的新顺序
【发布时间】:2010-11-24 13:45:16
【问题描述】:

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

【问题讨论】:

    标签: dojox.grid


    【解决方案1】:
    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;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-10-03
      • 2023-03-19
      • 1970-01-01
      • 2021-10-20
      • 1970-01-01
      • 2023-04-01
      • 1970-01-01
      • 2021-10-25
      相关资源
      最近更新 更多