我们一直在寻找一种在同一网格中进行一些列拖放操作后记录增强网格中列的顺序的方法,因为在DnD操作后网格的布局没有改变,我无法找到任何获得列序列的方法。 这有什么直接的方法吗? 或者,我们是否有任何与DnD相关的事件,可用于跟踪网格中列的顺序。
答案 0 :(得分:0)
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;
}