How to load a grid with the initial view scrolled to the right most column?
Docs for Column Properties say:
lockPosition Set to true to always have column displayed first.
But setting lockPosition: true on the right most column does not change the initial display.
Thanks!
lockPosition: true moves the column to the left most.
To scroll to any column on initial grid load:
in onGridReady function:
params.api.ensureColumnVisible("column field id");
Related
Is there some way to make responsive grid's rows with direction column?
For example md=6 columns, sm=12 columns etc.
Finally I'm using useMediaQueries and Breakpoints to check condition true or false, then render elements...
I am wondering if there is a way to effectively lock a column in Ag-Grid so that the column is always the very last column no matter what.
Background
What I am ultimately looking for is to avoid the blank space after the last column if the grid size is wider than all column width combined. This is to give the grid a consistent, professional look especially considering even/odd rows are rendered usually in different color. I would prefer the blank space also has that alternating background color.
Given there seems to be no grid property that forces the grid to render the blank space at the end as a pseudo column, I am therefore considering to add a pseudo column manually in such a way that:
the pseudo column has no header
the pseudo column has no data
the pseudo column is not sortable (achieved via sortable: false)
the pseudo column is not manually resizable (achieved via resizable: false)
the pseudo column is the only column which has suppressSizeToFit: false
lock the pseudo column to always be the last column so that user cannot drag a column to the right side of it
I've found a way to achieve everything apart from the last item in the above list. I know I can suppressMovable: true but that only ensures the column itself is not draggable, it does not prevent user from dragging a column to the right side of it.
Effectively, I am looking for something similar to lockPosition but instead of locking the column to the front I want to lock the column to the end.
Keep an eye on currently open AG-3326 issue in ag-grid backlog https://www.ag-grid.com/ag-grid-pipeline/
"Allow locking ( lockPosition ) a column to always be either the first or last columns (currently only the first column is supported)"
What I am ultimately looking for is to avoid the blank space after the last column if the grid size is wider than all column width combined
You could use sizeColumnsToFit() API for columns to adjust in size to fit the grid horizontally. Using this API, there won't be any blank space after the last column, but make sure you have not specified the width for at least one column. This is the column that will expand/shrink to fit the size of the grid.
Call sizeColumnsToFit() after the gridReady event has fired.
Here is an effective workaround to lock the right-most column until AG-3326 is implemented.
onColumnMoved: params => {
const columnCount = params.columnApi.getAllColumns().filter(c => c.isVisible()).length;
const maxIndex = columnCount - 2;
if(params.toIndex > maxIndex) {
params.columnApi.moveColumnByIndex(params.toIndex, maxIndex);
}
}
Any column that is moved to the right of the 'locked' column is immediately moved to the left of the 'locked' column.
The size of the boxes associated with my Tree Map are determined by a calculated field Sum([Total Employees]) * Min([Utilization %]). The product of the equation is not relevant and I would like to hide it but this is the only way I know how to set the ratio sizes of my boxes.
Just click on the Tooltip button in the Marks shelf, and remove the line with the calculated field. When you add a field to the shelf, it automatically gets added to the tooltip most of the time.
In my table I have repeating value.
I have put isPrintRepeatedValues=false to avoid the repeat values. It was success but I found that the left border is missing for the left cell in a row.
How to make to cover his line for a repeat row only?
The result would be as at the picture (highlighting area) below:
My requirement is to increase the Detail band height dynamically when the text field has more data. Are there any settings to increase to it? I am using one textField in the Detail band when it has more information (words), it is displaying only some information.
i.e the words are being cut off. Depending on the detail band height the words are displaying. I would like to increase the band height dynamically when the text field has more data.
First select your field and set following properties (third one is most important):
Position type: float
Stretch type: relative to tallest object
Stretch with overflow: true (checked)
Go to Report level properties. Advanced - Set the Column count and then Print order as Horizontal
Try setting the text field and surround object to Position Type Float in the object's properties.
This should let the report expand as the text field grows.