Angular UI-Grid v4.0.4에는 확장 가능한 행 안에있는 각 행에 대해 'ViewLog'라는 버튼이 있습니다. ViewLog 단추를 클릭하면 자식 행 안에있는 데이터를 표시하려고합니다. cellTemplate
에서 row.entity.subGridOptions.data
배열이며, 상기 예에서는 제확장 행에 일치하는 subGridOptions.data 요소를 어떻게 찾습니까?
gridApi.expandable.on.rowExpandedStateChanged($scope, function (row) {
if (row.isExpanded) {
row.entity.subGridOptions = {
appScopeProvider: $scope,
columnDefs: [
{
name: 'Log',
field: '',
width: "85",
cellTemplate: '<button ng-click="grid.appScope.displayLogFile(row.entity.subGridOptions.data[howToFindRightElement]);">View Log</button>'
}
]
};
}
});
:
이
는 구조expandable
위한
Parent Row 1
|
--- (ViewLog) Child 1 (json for child 1)
--- (ViewLog) Child 2 (json for child 2)
--- (ViewLog) Child 3 ...
|
Parent Row 2
|
--- (ViewLog) Child 1 (json for child 1)
--- (ViewLog) Child 2 ...
코드이다. 부모 행을 확장 한 후 선택한 자식 행과 일치하는 해당 배열에서 올바른 요소를 식별하는 방법을 알아낼 수 없습니다.
자식 행에서 JSON을 찾아서 displayLogFile()
으로 전달하고 싶습니다.
코드를 추가 할 수 있습니까? row.entity가 어떻게 구조화되어야하는지에 대한 의미에서. –
@JonBlack 아무것도 표시 할 필요가 없습니다. 단순히 현재 subGrid 행이 무엇인지 알아 내려고합니다. row.entity.subGridOptions.data []에서 요소를 가져올 수 있도록 버튼을 누른 행을 찾습니다. – Dayan
그게 내 혼란이야. 당신이 이걸로 무엇을 준비하고 있는지 이해하기가 어렵습니다. 나는'appLogB64'가 어디에서 왔는지 이해하지 못합니다. 당신이 확장 한 원래의 행에서 오는 것이지요? 아니면 subGridOptions에서 얻는 추가 데이터에서 오는 것입니까? –