I'm using a ListGrid as the Canvas for a CanvasItem and I want the grid to automatically size itself to the minimal size required to show the data in it, typically just two or three records. I'm not showing column headings and there are only three fields in the grid. I want the columns to autosize to the content and the grid to autosize both vertically and horizontally to fit the data in the least space possible.
I have the following settings on the grid.
grid.setShowHeader(false);
grid.setAutoFitData(Autofit.BOTH);
grid.setAutoFitFieldWidths(true);
And I am using setHeight("*") on the CanvasItem.
That works fine for the height, but not the width. The width of each column is much wider that it needs to be to fit the data. Consequently the CanvasItem is much wider than it needs to be.
I've tried adding setWidth("*") to the CanvasItem but that makes no difference. Is there another setting I'm missing?
Also, there is a border around the grid. Is there any way to get rid of the border?
I have the following settings on the grid.
grid.setShowHeader(false);
grid.setAutoFitData(Autofit.BOTH);
grid.setAutoFitFieldWidths(true);
And I am using setHeight("*") on the CanvasItem.
That works fine for the height, but not the width. The width of each column is much wider that it needs to be to fit the data. Consequently the CanvasItem is much wider than it needs to be.
I've tried adding setWidth("*") to the CanvasItem but that makes no difference. Is there another setting I'm missing?
Also, there is a border around the grid. Is there any way to get rid of the border?
Comment