Hello,
I am applying a filter to the data, which results in a new searchModel which my dataset uses. But regardless of how many rows are within the dataset, the height of the GridView remains the same as the original height (containing blank space below the filtered rows).
Here is my applyFilterWithText method in my datasource:
- (void)gridView:(IGGridView*)gridView applyFilterWithText:(NSString*)filterText
{
[self.data localSearchWithTerm: filterText ];
_footerView.text = [self titleForFooter];
[self.gridView reloadData];
[self.gridView invalidateIntrinsicContentSize];
}
So you can see that I am calling reloadData and invalidateIntrinsicContentSize, but that does not resize the grid after filtering the results.
I also tried overriding the heightForRowAtPath method like this, but it only gets called for the 2 filtered rows. The grid height is still the original height:
-(CGFloat)gridView:(IGGridView*)gridView heightForRowAtPath:(IGRowPath*)path
BOOL hasValue = [self.getData containsRowAtIndex:path.rowIndex];
if (hasValue)
return 46.0f;
return 0.0f;
Hmm... maybe there could be another need for the event, but I don't think I would need it if the "auto-resize to content" option were in there, which I would prefer, since it sounds like a reasonable general feature for a grid to have. Thanks...
Hi Michael,
Unfortunately, without subclassing, I don't have a good solution for you. We don't currently have any special events that we raise when the new size is calculated. However, we could easily add something like that for you, if you'd like.
-SteveZ
I have been doing this after setting the datasource and calling ReloadData(), to set height to ContentSize.Height, which works fine when the grid is initially setup in my single helper function:
var gridFrame = new RectangleF(x: parentFrame.X, y: parentFrame.Y, width: parentFrame.Width, height: gridView.ContentSize.Height); gridView.Frame = gridFrame;
Ideally though, I'd do this whenever the ReloadData or UpdateData is called, but I don't see any event that exists to let me know this has happened. I need the grid to do its thing based on the datasource, then be able to set the height based on ContentSize afterwards, and I'd rather not subclass the grid if possible. Any ideas on this one (I'm using c#)?
I would really like to see this autosize option as well, and posted this in the ideas area here, with a link back to this post:
http://ideas.infragistics.com/forums/211525-nuclios/suggestions/6242917-grid-option-to-autosize-height-based-on-content
Thanks for the answer, Steve.
Our gridview is part of a larger screen with other elements, which itself has a scrollview as the root view. Therefore the GridView itself is not scrollable. (Should never have a scrollview within a scrollview)
I think i will work around the resizing issue by utilizing custom rows for the user instruction message cell, instead of the current grid footer view, so that my instructional message can be visible directly under the last visible row. Currently my footer view is off the bottom of the screen, even if there are no records to show.
Thanks,
Alex