Dojo 拡張グリッドで列名から列インデックスを取得するにはどうすればよいですか???? どんな助けでもいただければ幸いです
2950 次
1 に答える
3
これがあなたが探しているものかどうかはわかりませんが、グリッドの「フィールド」属性を知り、列のインデックスを決定する私の強引な方法は次のとおりです。
var retrieveFieldIndexByFieldName = function(fieldName) {
var exGrid = dijit.byId("grid1"); // assuming grid1 is your grid
var index = -1;
dojo.forEach(exGrid.layout.cells, function(cell,idx) {
if (cell.field == fieldName) {
index = idx;
return false; // please do check if return false is needed here
// I actually forgot if this one was needed to exit the forEach loop of dojo
}
}
return index;
}
そこで。お役に立てれば。
于 2011-11-23T06:40:03.500 に答える