0

特定の列に richSelect ドロップダウンが使用されている ag-grid リーチ ベースのアプリケーションがあります。一部の richSelect 列では、ドロップダウンの値は ID に基づく必要があります。

私の JSON データは次のようになります。

data : [{
        collegeId : "MIT",
        users : [{
                name : "Alex",
                country : "USA"
            }, {
                name : "Barbara",
                country : "Canada"
            }
        ]
    }, {
        collegeId : "Berkeley",
        users : [{
                name : "Samantha",
                country : "Australia"
            }, {
                name : "Amanda",
                country : "Germany"
            }
        ]
    }
]

私のcolDefsは次のようになります。

{ headerName : "Users", field: "users", filter: "text", 
    cellEditor : "richSelect",
    cellEditorParams : {
        values : this.getValues()
    }
}

問題は、MIT の行で、ユーザー リストに Alex と Barbara のみを含めることです。同様に、Berkeley の場合、Samantha と Amanda のみを含めるには User の richSelect が必要です。

ここでユーザーリストはcollegeIdに依存します。getValues() では、すべてのユーザーを取得できますが、collegeId の一致に基づいて取得する方法がわかりません。

4

1 に答える 1

0

以下のように値を更新できます--

ここで $scope.newMap マップを作成し、キー、値でマップに表示する値を追加し、cellEditorParams に割り当てます

 for(var x=0;x<$scope.gridOptions.columnDefs.length;x++){
            if($scope.gridOptions.columnDefs[x].headerName==="Bank Name"){
                $scope.gridOptions.columnDefs[x].cellEditorParams.values=$scope.newMap;
            }
        }
于 2017-01-04T07:56:05.797 に答える