ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

Vertical scrolling and custom row heights don't play nice together

Open ghost opened this issue 12 years ago • 4 comments

Compare this example from the tutorial: http://ui-grid.info/docs/#/tutorial/112_swapping_data with this Plunker: http://plnkr.co/edit/jFRAHzenPEkF9OX2Lqda?p=preview The only difference is in the custom row template in the Plunker that has a height of 80px. Because of the extra height some of the initial data in the table is out of view. However, it is not possible to scroll to this data. In the tutorial example, on the other hand, a scrollbar does appear once you have added enough rows to fill the table's viewport.

ghost avatar Oct 14 '14 13:10 ghost

I don't think this is a bug, but rather a case of misuse. The height of the underlying model won't get updated when you set the row height with rowTemplate. Using the GridOptions.rowHeight option will make sure that both the model and view gets updated. Here's a plunker with my changes: http://plnkr.co/edit/itKd7YHCQTRk7HhKAjAa?p=preview

@PaulL1, if being able to change the rowHeight via the rowTemplate is a desired feature I could add functionality that enables this.

mathiasdose avatar Oct 17 '14 12:10 mathiasdose

Ah. Very good pickup. I think it is better to just use the already provided option, although I can see some benefit in letting people just give a template and then using the height from that. I guess the issue is if we ever allowed different templates on different rows - it's a hard and fast rule that height is always the same for every row.

PaulL1 avatar Oct 17 '14 20:10 PaulL1

@mathiasdose Thank you for pointing out the 'rowHeight' option. It does exactly what I was trying to achieve and it is obviously a better solution than overriding the entire row template. Still one thing: this option currently appears to be undocumented.

ghost avatar Oct 20 '14 06:10 ghost

+1 Please add documentation for rowHeight. I only knew of it when I found this GitHub issue page.

McShazy avatar Oct 20 '14 14:10 McShazy