The help text for TcxCustomGridTableView.ApplyBestFit clearly indicates that this method considers the with of the grid column caption:
"The ApplyBestFit method iterates through data records and calculates the maximum width of item cells. It also takes the width of the item caption...."
The help text for TcxCustomPivotGrid.ApplyBestFit doesn't mention anything about considering the field's caption in determining the width and in practice, fields with long captions will be truncated if the field values are narrow.
It would seem that the two grids would benefit from consistency and that the behavior displayed by the quantum grid is most desirable.
Suggestion: Change TcxCustomPivotGrid.ApplyBestFit to consider the field's caption extent as well as the extent of the contents.
Thank you for your message. I am afraid I do not quite understand this suggestion. As I see, our ExpressPivotGrid already supports this functionality. Please refer to the attached example. TcxPivotGrid behaves as expected in this situation.
Would you please provide us with more detailed information about this problem in a step-by-step manner?
I apologize for not being clear enough. Perhaps the attached project will demonstrate what I am describing.
The screen shot in the zip file shows the pivot grid after the 'Apply bestfit' button is clicked. You should be able to reproduce by making the 1st data column (labeled 'This is a...') very wide, say 200 to 300 pixels. Then click <Apply bestfit>
It looks like ApplyBestFit is only considering the cell values in the grid and ignoring the field caption, which in this case is "This is a really, really long caption".
If you set up a quantum grid with a similar datacontroller and called ApplyBestFit on that grid, the DataField1 column would be made width enough to fully display the long caption.
Do this make sense now?
Thank you for your sample project. It makes things more clear. Now I see that the ApplyBestFit method works as expected if you place the "ColField" field into the column area. When PivotGrid displays only the "GrandTotal" column, the ApplyBestFit method works differently.
Don't you mind if I rename this suggestion to "PivotGrid.ApplyBestFit should take into account a data field caption width when there are no fields in the column area"?
Please feel free to rename it to whatever makes it clearer.
I had not noticed that when there is a field in the column area, then ApplyBestFit works as one would expect. As you point out, it looks like it's only a problem if there are zero column fields.
Based on that, I think this should be classified as a defect rather than a suggestion. Do you agree?
Thank you for you help
Is your intention to post an answer to your own question?
- If so, then proceed.
- If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
- If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.