I am not sure if I am doing something wrong here or if the documentation is wrong or misleading. I am trying to use the FullWidthRowCell feature for detail panels for each row. However, it appears not to completely work as documented. As I recently made the jump from v4 to v6 of ag-grid, I thought I would ask here if I was in error before making a bug report of this.
Description:
I changed an existing data grid so that I would potentially have a details panel that expands out to show additional info in another format. I also wanted to use a react component that I would be reusing elsewhere. Currently, the panel will open and show only a blank area (where the panel should be) and produce an error message. I have used the "cellRendererFramework" successfully in my column definitions.
Documentation references:
section: Full Width Rows & Master Detail Grids
Provide a fullWidthCellRenderer, to tell the grid what cellRenderer to use when doing fullWidth rendering.
The cellRenderer can be any ag-Grid cellRenderer. Refer to Cell Rendering on how to build cellRenderers. The cellRenderer for fullWidth has one difference to normal cellRenderers, that is the parameters passed are missing the value and column information as the cellRenderer, by definition, is not tied to a particular column. Instead you should work off the data parameter, which represents the value for the entire row.
section: React Cell Rendering, Specifying a React cellRenderer
This same mechanism can be to use a React Component in the following locations:
colDef.cellRendererFramework colDef.floatingCellRendererFramework gridOptions.fullWidthCellRendererFramework gridOptions.groupRowRendererFramework gridOptions.groupRowInnerRendererFramework
gridOptions.fullWidthCellRendererFramework is a specified option!
Example setup:
Below is some of the import parts of my settings (yes its omitting col definitions and other stuff that are in my actual version).
grid options(snippet):
gridOptions = {
doesDataFlower: (data) => { return true; }
isFullWidthCell: function(rowNode) {
var rowIsNestedRow = rowNode.flower;
return rowIsNestedRow;
},
getRowHeight: function(params) {
var rowIsNestedRow = params.node.flower;
return rowIsNestedRow ? 100 : 25;
},
fullWidthCellRendererFramework: AppointmentDetail
}
A simple stub test component that I tried
class AppointmentDetail extends React.Component<any, any>
{
render() {
return <div>AppointmentDetail</div>
}
}
However, if I use non-react method
fullWidthCellRenderer: (params) => { return "<div>Test</div>"; }
or the old method for react components (which I thought was not intended by the author to be used anymore)
fullWidthCellRenderer: reactCellRendererFactory(AppointmentDetail)
then the full row renders properly.
Warnings:
ag-Grid: you need to provide a fullWidthCellRenderer if using isFullWidthCell()
The component does kindly provide me an error that tells me what is wrong. It is just the documentation seems to indicate that this should be valid.
Version: Just in case this is needed... here is my version taken from my webpack dependencies.
"ag-grid": "^6.0.1",
"ag-grid-react": "^6.0.1",
"react": "^15.3.2",
Edit(s):
I edited gridProps to gridOptions to better illustrate that these are the grid options that I am giving ag-grid. It appears this was not clear, based on the response that told me to do exactly what I stated I did and did not work.
Added react version.