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;
Hi Alex,
When the IGGridView has rows that takes up less space than its bounds, it limits its contentSize to the size of the viewport. This was done on purpose, as usually users do not want the IGGridView to resize, and instead, want the content area to still take at least the full height of the IGGridView.
I guess you could say the IGGridView wasn't specifically designed to update its height based on its content. And since intrinsicContentSize is just inherited from the UIScrollView there isn't any specific logic to have it magically resize. You'd basically have to set the bounds or frame of the IGGridView to adjust.
That being said, i suppose we could add the logic to support this case, however it might have to be an opt-in mechanism, as I could see the argument for both approaches.
Out of curiosity, are you never allowing the IGGridView to scroll? Or are you just limiting it to have a max height/width?
-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