OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Ag Grid autoHeight and wrapText not working when using custom cellRenderer

  • Thread starter Thread starter Elumalai Kaliyaperumal
  • Start date Start date
E

Elumalai Kaliyaperumal

Guest
I'm trying to wrap the text of lengthy cell value. As per documentation setting autoHeight=true and wrapText=true working fine without cellRenderer components. But when using cellRendererFramework React component, seems not working. I tried to setting style inside custom cell renderer also not working. Any help would be greatly appreciated!

AgGrid component is as below,

Code:
<AgGridReact
    {...configs}
    onGridReady={onGridReady}
    masterDetail={true}
    suppressContextMenu
    detailCellRenderer='agCustomDetailTimelineRenderer'
    detailRowHeight={140}
    frameworkComponents={{
        agCustomRenderer: CustomRenderer,
    }}>
    {configs.columnDefs.map((columnDef) => (
        <AgGridColumn {...columnDef} />
    ))}
</AgGridReact>

Default column definition is,

Code:
defaultColDef: {
    sortable: true,
    filter: true,
    wrapText: true,
    autoHeight: true,
    menuTabs: ['filterMenuTab']
}

And my custom React component is,

Code:
import React from 'react';

const CustomRenderer = (props) => {
  return (
    <div
      style={{ height: '100%', whiteSpace: 'normal', wordBreak: 'break-all' }}>
      {props.value}
    </div>
  );
};

export default CustomRenderer;
<p>I'm trying to <code>wrap the text</code> of lengthy cell value. As per documentation setting <code>autoHeight=true</code> and <code>wrapText=true</code> working fine without <code>cellRenderer</code> components. But when using <code>cellRendererFramework</code> <code>React component, seems not working</code>. I tried to setting style inside custom cell renderer also not working. Any help would be greatly appreciated!</p>
<p>AgGrid component is as below,</p>
<pre><code><AgGridReact
{...configs}
onGridReady={onGridReady}
masterDetail={true}
suppressContextMenu
detailCellRenderer='agCustomDetailTimelineRenderer'
detailRowHeight={140}
frameworkComponents={{
agCustomRenderer: CustomRenderer,
}}>
{configs.columnDefs.map((columnDef) => (
<AgGridColumn {...columnDef} />
))}
</AgGridReact>
</code></pre>
<p>Default column definition is,</p>
<pre><code>defaultColDef: {
sortable: true,
filter: true,
wrapText: true,
autoHeight: true,
menuTabs: ['filterMenuTab']
}
</code></pre>
<p>And my custom React component is,</p>
<pre><code>import React from 'react';

const CustomRenderer = (props) => {
return (
<div
style={{ height: '100%', whiteSpace: 'normal', wordBreak: 'break-all' }}>
{props.value}
</div>
);
};

export default CustomRenderer;
</code></pre>
Continue reading...
 

Latest posts

Top