How to add a vertical scrollbar to a ext gridpanel when the grid reaches certain height?
Question
I have a popup window that has a tab panel and 'save' button below it. One of the tab contains a gridpanel and 'Add New Row' button. Initially, the gridpanel has no rows. How can I display a vertical scrollbar when gridpanel's height reaches certain pixel values, or certain no. of rows are added? The code looks like this:
<ext:Window ID="Window1" runat="server" Height="600px" Width="400px" Title="Popup Window">
<Items>
<ext:TabPanel ID="tabMain" runat="server" Width="400px" Height="300px">
<Items>
<ext:Panel ID="pnlItem" runat="server" Title="Item">
<Items>
<ext:Container runat="server">
<Content>
<div>
...
...
</div>
</Content>
</ext:Container>
</Items>
</ext:Panel>
<ext:Panel ID="pnlQuantities" runat="server" Title="Quantities">
<Items>
<ext:Container runat="server">
<Content>
<div>
Grid Below:
</div>
<div>
<ext:GridPanel ID="gridQuantities" runat="server" Width="400px" Height="200px" Header="false">
<Store>
..........
..........
</Store>
</ext:GridPanel>
<ext:Button ID="btnAddRow" runat="server" Text="Add New Row" Icon="Add">
<Listeners>
<Click Fn="addNewRow" />
</Listeners>
</ext:Button>
</div>
</Content>
</ext:Container>
</Items>
</ext:Panel>
</Items>
</ext:TabPanel>
<ext:Container runat="server">
<Items>
<ext:Button ID="btnSave" runat="server" Text="Save" Icon="Disk"></ext:Button>
</Items>
</ext:Container>
</Items>
</ext:Window>
How can I do this please help.
Solution
Thanks Lorenz Meyer. I just had to add AutoScroll: true to my GridPanel. And also I set MaxHeight to 200 so whenever the grid reaches 200px height, the vertical scrollbar appears.
<ext:GridPanel ID="gridQuantities" runat="server" Width="400px" MaxHeight="200" Header="false" AutoScroll="true">
<Store>
..........
..........
</Store>
</ext:GridPanel>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow