getState() を使用してグリッド列ヘッダー名 (表示名) を取得できますか?
質問する
501 次
1 に答える
0
番号。しかし、この非常に複雑な関数はそれらを配列として返します。
function getGridClipboardText(grid){
var columns = grid.columns,
headerData = [],
subHeaderData = [],
dataIndex = [],
du = Sms.dataUtilities,
columnCount = columns.length,
startIndex = 0,
headerText,
subColumnCount,
visibleSubColumns,
columnCollection,
i, j, col, subCol;
// If grid has a row expander plugin, skip the first column
if(grid.expanderDataIndex){
startIndex = 1;
}
// Collect the header titles
for(i = startIndex; i < columnCount; i++){
col = columns[i];
if(!col.hidden){
headerText = du.getInnerHtml(col.text);
// Flatten the data index references to a single array
if(col.dataIndex){
dataIndex.push({
dataIndex: col.dataIndex,
clipboard: col.clipboard
});
}
// If the column has sub-columns, handle them
// IMPORTANT: This function only supports two levels of headers.
// When upgrading to fully-nested headers, use a recursive algorithm.
if(col.items && col.xtype !== "actioncolumn"){
if(Ext.isArray(col.items)){
columnCollection = new Ext.util.MixedCollection(false);
columnCollection.addAll(col.items);
}
else{
columnCollection = col.items;
}
subColumnCount = columnCollection.getCount();
visibleSubColumns = 0;
for(j = 0; j < subColumnCount; j++){
subCol = columnCollection.getAt(j);
if(!subCol.hidden){
visibleSubColumns++;
subHeaderData.push(du.getInnerHtml(subCol.text));
if(subCol.dataIndex){
dataIndex.push({
dataIndex: subCol.dataIndex,
clipboard: col.clipboard
});
}
}
}
// If there are no sub-columns, but there could be, create a spacer
// in the array to keep everything lined up
if(subColumnCount === 0){
subHeaderData.push("");
}
// Pad the main header with extra tabs to account for the sub-columns
for(j = 0; j < visibleSubColumns - 1; j++){
headerText += "\t";
}
}
headerData.push(headerText);
}
}
return headerData;
}
于 2012-06-29T16:26:27.810 に答える