Ag-grid reaction not displaying properly

Following the sample from the docs: https://www.ag-grid.com/best-react-data-grid/index.php

After creating a new response application (tried several times on different machines)

create-react-app whatever

If I use style sheets (ag-grid.css and theme-fresh.css), then everything that is displayed is the gray line on the page. Any other combination makes a blank page. Removing ag-grid.css displays the grid, but it is shuffled everywhere.

Has anyone used this recently with React? Anyone recommend something else? (requirements: paging, sorting, filtering, selection of rows (rows))

thank: -)

import React, { Component } from 'react';
import {AgGridReact} from 'ag-grid-react';
import '../node_modules/ag-grid/dist/styles/ag-grid.css';
import '../node_modules/ag-grid/dist/styles/theme-fresh.css';

class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      columnDefs: [
        {headerName: 'First Name', field: 'name' },
        {headerName: 'Last Name', field: 'lname'  }
      ],
      rowData: [
        { name: 'Dave', lname: 'Smith' },
        { name: 'Tommy', lname: 'Smith' },
        { name: 'Lea', lname: 'Jones' }
      ]
    }
  }
  render() {
    return (
      <div className="ag-fresh">
        <AgGridReact
            columnDefs={this.state.columnDefs}
            rowData={this.state.rowData}
          rowSelection="multiple"
          enableColResize="true"
          enableSorting="true"
          enableFilter="true"
          groupHeaders="true"
          rowHeight="22"
          debug="true"
        />
      </div>
    );
  }
}

export default App;
+4
source share
2 answers

: - (

. , , .

+7

, - , :

<div className="ag-fresh">
  <div className="grid_height_fix">
  <AgGridReact columnDefs={this.state.columnDefs} rowData={this.state.data.gridDate} >
  </AgGridReact>
  </div>
</div>
.grid_height_fix {height:800px;}
Hide result
+1

Source: https://habr.com/ru/post/1655278/


All Articles