1 Reply Latest reply on May 1, 2007 7:59 AM by peterent

    Issues with DataGrid and scrolling

    ZTGuyInHampton2007
      Hello, I am having a problem with using the DataGrid class and scrolling. In my DataGrid, there is a certain column whose renderer factory class includes a custom built dynamically resizing text area. As more text is entered in this dynamic text area, it resizes vertically to accomidate the new text. I am using this component in a custom renderer. As the custom text area resizes, so does the renderer itself, and the row in which the renderer is a parent shrinks or grows accordingly. My problem is that when I scroll through a datagrid whose rows are of differing heights, the scroll bar thumb changes size depending on portion of the data grid I'm showing. Not only does this look bad, but it also prevents my data grid from working as intended. If I could get some feedback on a way to fix this problem. I would appreciate it. TIA.
        • 1. Re: Issues with DataGrid and scrolling
          peterent Level 2
          There isn't any way to "fix" this - the DataGrid is working as intended. Scrolling in the list components is item-based, not pixel based, so the scrollbar adjusts according to what is visible vs what is available. Since itemRenderers are not generated for invisible rows there is no way to calculate what size they will be.

          An alternative is to place the DataGrid into a Canvas and then set the DataGrid's rowCount to equal the number of records in its dataProvider. This will expose all of the rows and created itemRenderers for every row. Because the DataGrid is in a container, the container will then get a vertical scrollbar.

          The problem with this is that the DataGrid's header will scroll out of view and if you have a lot of records, could take some time to render. If you like this approach, you can make a second DataGrid which sits above the first, has no records, just a header while the DataGrid inside of the Canvas has no header.