bencripps/react-redux-grid

Question: How define column-cells alignment ?

Closed this issue · 1 comments

Hi,

Im starting to use react-redux-grid.
The current report has dates and numeric values.
It would be desirable the columns with numeric data are aligned to the right
How can I define the column-cells alignment?

image

thanks.

I would use a custom renderer which would allow you to write some custom CSS for these columns; something like:

const columns = [
    {
        name: 'Risk',
        dataIndex: 'risk',
        renderer: ({ column, value, row }) => {

            return (
                <span className="numeric-column">
                    {value}
                </span>
                );
        }
    }
];

And then simply add some CSS:

.numeric-column {
    text-align: right;
}

For more information about renderers, you can check out these docs.