I am using a gridGroupingGrid that uses a Custom Engine in which The GridRecordRow is overriden to implement the IGridRowHeight interface (i.e. we want to be able to manually set the row heights for rows in a record).
I use it in the following manner: The grid is composed of records that span two rows. There are cases where I set the second row in the record to a height of 0. But the first row is always set to the default row height.
However, there are cases where the text in the cells takes up more space than the width of the cell. Is there some mechanism that I can use to resize that the first row in the record, so it is large enough to fit the contents? However, I would like to maintain the ability to set row to a height of 0 for the second row.
HA
haneefm
Syncfusion Team
October 4, 2007 07:45 PM UTC
Hi Michael,
Please try this code and let me know if this helps.
gridGroupingControl1.TableModel.RowHeights.ResizeToFit(GridRangeInfo.Row(RowIndexOfFirstRowIntheRecord), GridResizeToFitOptions.ResizeCoveredCells);
Best regards,
Haneef
MS
Michael Sabin
October 4, 2007 09:04 PM UTC
Ok, thanks for the help. However, I am having a problem relating to rules in collapsed groups. Here is the code I am using:
int numRows = this.gridGroupingControl1.TableControl.Model.RowCount;
for (int i = 0; i < numRows; i++)
{
GridTableCellStyleInfo style = this.gridGroupingControl1.TableControl.Model[i, 2];
if (style.CellType.Equals("CheckBox"))
gridGroupingControl1.TableModel.RowHeights.ResizeToFit(GridRangeInfo.Row(i), GridResizeToFitOptions.ResizeCoveredCells);
}
I can tell if the row is the first row in a record if the CellType is a ComboBox. However, this code will skip all of the rows that are in a collapsed group. Is there a way to run the ResizeToFit on all records?
Thanks
HA
haneefm
Syncfusion Team
October 4, 2007 09:27 PM UTC
Hi Michael,
Is there a way to run the ResizeToFit on all records?
>>>>>>>>>
You can try this code:
gridGroupingControl1.TableModel.RowHeights.ResizeToFit(GridRangeInfo.Table(), GridResizeToFitOptions.ResizeCoveredCells);
and let me know if this helps.
Best regards,
Haneef
MS
Michael Sabin
October 5, 2007 12:40 PM UTC
Thanks, but this will prevent me from keeping the second row in the record to a height of 0. Is there any other workarounds?
>Hi Michael,
Is there a way to run the ResizeToFit on all records?
>>>>>>>>>
You can try this code:
gridGroupingControl1.TableModel.RowHeights.ResizeToFit(GridRangeInfo.Table(), GridResizeToFitOptions.ResizeCoveredCells);
and let me know if this helps.
Best regards,
Haneef
MS
Michael Sabin
October 5, 2007 05:39 PM UTC
OK, i think i figured a way around this:
before running the resize to fit code, call grid.Table.ExpandAllGroups(). Then after the resize, call grid.Table.CollapseAllGroups()