Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
45
How to resize the height of the whole IGGridView after applying a filter
posted

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;

}

The only way we found to resize the grid is to re-instantiate the whole grid and re-populate it from scratch.  Could you please let us know how we can resize the grid after applying a filter? 
Thanks,
Alex
Parents Reply Children
No Data