AG-Grid 문서 here에 따르면 gridOptions.api에는 테이블 내용의 데이터를 내보낼 수있는 메서드가 있습니다. 그러나 함수를 실행할 때마다 간단히 오류 Object doesn't support property or method 'exportDataAsCsv'
이 표시됩니다.exportDataAsCsv가 지원되지 않습니다. gridOptions.api의 속성 또는 메서드
그것은이 같은 조금 보이는 지침에서 실행중인 :
app.directive('myDirective', function() {
restrict: 'E',
template-url: "blah.html",
link:{pre: function(scope,ele){
var columnDefs = [
{ headerName: "Management Name", field: "ManagementName", width: 300 },
{ headerName: "Location", field: "Location", width: 150 },
{ headerName: "Backend System", field: "Vendor", width: 110 },
{ headerName: "Total Active Sites", field: "TotalActiveSites", width: 110 }
];
scope.gridOptions = { columnDefs: columnDefs, rowData: null }
},
post: function (scope,ele) {
scope.exportCsv = function() { scope.gridOptions.api.exportDataAsCsv(); }
scope.gridOptions.rowData = dataList;
scope.gridOptions.api.onNewRows();
}
그리고 내 HTML은 다음과 같습니다
<input placeholder="Filter..." type="text" ng-model="gridOptions.quickFilterText" />
<button ng-click="exportCsv()">
<img id="btnExportToExcel" alt="CSV File" src="../images/Excel.gif" style="cursor:pointer;" tooltip-placement="bottom" uib-tooltip="Excel" />
</button>
<div ag-grid="gridOptions" class="ag-blue" style="height:100%"></div>
그리드는 잘 실행하지만, 어떤 이유로 그렇지 않습니다 이 방법이 존재한다고 생각하십시오. 그 이유에 대한 아이디어가 있습니까? 나는 ag-grid 버전 1.12를 사용하고 있습니다. 내 참조가 모두 좋다고 가정하고, 그렇지 않으면 그리드를 표시하지 않을 것입니다.