# DataGrid fit into a panel question

**URL:** <https://forum.kirupa.com/t/datagrid-fit-into-a-panel-question/296400>\
**Category:** flash\
**Created:** [September 14, 2009, 5:07pm UTC](https://forum.kirupa.com/t/datagrid-fit-into-a-panel-question/296400 "2009-09-14T17:07:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cpthk](https://avatars.discourse-cdn.com/v4/letter/c/aca169/32.png) [@cpthk](https://forum.kirupa.com/u/cpthk)\
**Post date:** [September 14, 2009, 5:07pm UTC](https://forum.kirupa.com/t/datagrid-fit-into-a-panel-question/296400/1 "2009-09-14T17:07:04Z")

</div>

Hi:  
Here is my code.

```auto

</mx:Panel>
    <mx:DataGrid dataProvider="{totalDataGrid}" rowCount="6" textAlign="center">
        <mx:columns>
            <mx:DataGridColumn dataField="name" headerText="Name" width="65" fontSize="10"/>
            <mx:DataGridColumn dataField="split" headerText="Split" width="65" fontSize="10"/>
            <mx:DataGridColumn dataField="paid" headerText="Paid" width="65" fontSize="10"/>
            <mx:DataGridColumn dataField="total" headerText="Total" width="65" fontSize="10"/>
        </mx:columns>
    </mx:DataGrid>
    
</mx:Panel>

```

I have a datagrid inside a panel. All the values of this datagrid is dynamically provided after this flex application initiated. The datagrid is always 6 rows, and I want the datagrid fits the panel exactly. I found this problem. Whenever there is no data in the datagrid, the panel expand exactly the size to fit this datagrid, which mean I don’t see any scroll bar in the datagrid. Whenever I trigger a event to insert data into this datagrid with 6 rows, the datagrid seems like expand a little and no longer fits in the panel. I tried all possible properties like font size, row height. I can’t fix the problem. Anyone know which property makes the datagrid expand a little?

![](http://www.kirupa.com/forum/attachment.php?attachmentid=50757&stc=1&d=1252948123)
