AgGrid: Take out 2 different Services in a Master / Detail

0

I am showing in an AgGrid the data of a project.json and the rows are seen correctly.

Showing your Master / detail Same .json does it right ( Without doing an http.get)

The problem comes when I want to show the Master / Detail of a .Json Different

Since I could not show it (console.log), I tried to show the same data twice, and they are not displayed either. I get a get undefined.

 constructor(private http: HttpClient, private translate: TranslateService) {

    this.columnDefs = [
       {  headerName: "IM",
          field: 'name' }
   ],

   detailGridOptions: {
        columnDefs: [
          { field: 'Im' }
        ],
        onGridReady: function(params) {
          params.api.sizeColumnsToFit();
        }
      },

  getDetailRowData: function(params) {
    setTimeout(function() {
      this.http.get('/api/projects').subscribe(data => {
        console.log('2',data);       //------>>>           Here get undefined
        params.successCallback(data);
      });
    }, 1000);
   }
  };
}

onGridReady(params) {
    this.gridApi = params.api;
    this.gridColumnApi = params.columnApi;

    this.http.get('/api/projects').subscribe(data => {
      console.log('1', data); // I get the Array succesfull
      params.api.setRowData(data);
      this.rowCounts = params.api.getDisplayedRowCount();
      this.countOnSelectionChanged();
    });

  params.api.sizeColumnsToFit();
    setTimeout(function() {
      params.api.forEachNode(function(node) {});
     }, 500);
  }

Summing up:
console.log('1',data); shows the data and in the console.log('2',data); it does not show them being the same. Json How will I use a different .Json if it is not able to show me the same?

    
asked by EduBw 02.05.2018 в 17:47
source

0 answers