Hi,
I am trying to set the width of an dropdown in a grid. I am using CalculateAutoResizeWidth function to get the width of a column and then sum up all visiable columns to get the complete size.
This works fine on dropdowns that don't have filters. But as soon you add filter and filtering away the widest value, the width of the dropdown is still calculated based on all rows and not just the rows that have "IsFilteredOut" parameter set to false.
Is this a known issue?
Can I do some kind of workaround to solve this problem?
Regards
Mathias
Hi Matthias,
Which overload are you calling? Are you passing in a PerformAutoSizeType?
You probably have to specify VisibleRows. Although I guess theoretically, AllRows should still ignore hidden rows. What version of the control are you using? Do you have the latest Hot Fix?
Hi, fast response! =)
I am calling the function like this:CalculateAutoResizeWidth(PerformAutoSizeType.AllRowsInBand, False) in BeforeDropDown event handler.
The version of the UltraWinGrid is 5.3.20053.1086
I've tried the PerformAutoSizeType.VisibleRows also, but with the implication that the width was calculated to 4 instead of ~400. Like that there were no visible rows at the time. But checking the list of rows in debugging shows that the rows are there and have text etc. The filter have been applied, I think, it has at least the property IsFilteredOut set to True on one of the rows.
ThanksMathias
Hi Mathias,
My guess is that the AutoSizing intentionally includes rows that are filtered out. Now that I think about it, it kinda makes sense. For example, say you have the FilterRow visible to the user and they filter the data and then autosize a column. If they then clear the filter, you don't want them to have to resize the column again.
On the other hand, I could be wrong and this might be a bug in the version of the grid you are using. That's a pretty old version - almost 4 years old.
If you want to post a small sample project here that demonstrates the behavior you are getting, I'd be happy to try it out in the latest version and see if the behavior has changed.
Hello,
A collegue of mine found a workaround.
Calculate the width of visible rows in event handler AfterDropDown.
This solved the problem with the width when there is still data to show after filtering. Now we still kept the calculation of the width in the BeforeDropDown to solve that weird shadows appeared when the grid column is resized horizontally. In the latest hotfix this was solved, but other strange things happends then. But keeping the recalculation in BeforeDropDown solved this.
Another thing that happens is that the height of the grid drop down, when it have been filtered totally (0 rows to show), is showing an empty drop down with the originally height of all rows, not just the filtered or the height of MaxDropDownItems. Do you know anything about this?Do we have to recalculate the height aswell?
Thanks for the help.
RegardsMathias
I don't know, I guess since there are no rows it just uses the last calculated height, rather than a height of 0.