PDA

View Full Version : [CLOSED] GridPanel AutoExpandColumn



Timothy
Sep 16, 2008, 8:06 PM
Hello,

Geoffrey, perhaps you can help me out again. I've got a GridPanel which is concealed within an collapsed Panel. When I expand the Panel the AutoExpandColumn does not appear to work.

Example.aspx:


<%@ Page Language="C#" %>
<%@ Register assembly="Coolite.Ext.Web" namespace="Coolite.Ext.Web" tagprefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Customers.DataSource = new object[]
{
new object[] { "Timothy Grant Vogelsang" }
};
Customers.DataBind();
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Word</title>
</head>
<body>
<p><a href="Example.aspx">Reload</a></p>
<form id="form1" runat="server">
<ext:ScriptManager ID="ScriptManager1" runat="server" />
<ExtJS:Panel ID="Panel1" runat="server" AutoHeight="True" AutoScroll="True" BodyStyle="padding: 5px;" Border="False" Collapsible="True" Collapsed="True" Title="Panel 1">
<Content>
<ExtJS:Store ID="Customers"
runat="server"
AutoLoad="True">
<Reader>
<ExtJS:ArrayReader>
<Fields>
<ExtJS:RecordField Name="DisplayName" />
</Fields>
</ExtJS:ArrayReader>
</Reader>
</ExtJS:Store>
<ExtJS:GridPanel ID="dgPermission"
runat="server"
StoreID="Customers"
AutoExpandColumn="DisplayName"
HideHeaders="True"
StripeRows="True">
<ColumnModel>
<Columns>
<ExtJS:Column ColumnID="DisplayName" DataIndex="DisplayName" MenuDisabled="True" />
</Columns>
</ColumnModel>
</ExtJS:GridPanel>
</Content>
</ExtJS:Panel>
</form>
</body>
</html>


Any help would be appreciated, this one is a proper bugger.

Cheers,
Timothy

Vladimir
Sep 17, 2008, 7:01 AM
Hi Timothy,

try to wrap GridPanel into the FitLayout



<%@ Page Language="C#" %>
<%@ Register assembly="Coolite.Ext.Web" namespace="Coolite.Ext.Web" tagprefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Customers.DataSource = new object[]
{
new object[] { "Timothy Grant Vogelsang" }
};
Customers.DataBind();
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Word</title>
</head>
<body>
<p><a href="Example.aspx">Reload</a></p>
<form id="form1" runat="server">
<ext:ScriptManager ID="ScriptManager1" runat="server" />

<ext:Store ID="Customers"
runat="server"
AutoLoad="True">
<Reader>
<ext:ArrayReader>
<Fields>
<ext:RecordField Name="DisplayName" />
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>

<ext:Panel ID="Panel1" runat="server" AutoHeight="True" AutoScroll="True" BodyStyle="padding: 5px;" Border="False" Collapsible="True" Collapsed="True" Title="Panel 1">
<Content>
<ext:FitLayout runat="server">
<ext:GridPanel ID="dgPermission"
runat="server"
StoreID="Customers"
AutoExpandColumn="DisplayName"
HideHeaders="True"
StripeRows="True">
<ColumnModel>
<Columns>
<ext:Column ColumnID="DisplayName" DataIndex="DisplayName" MenuDisabled="True" />
</Columns>
</ColumnModel>
</ext:GridPanel>
</ext:FitLayout>
</Content>
</ext:Panel>
</form>
</body>
</html>

Timothy
Sep 17, 2008, 8:42 AM
Cheers vlad, will give that a go!

Timothy

Timothy
Sep 17, 2008, 9:46 AM
Worked beautifully vlad! I tried the FitLayout yesterday and it didn't work; but I think I had the Store and the GridPanel in the FitLayout which might have botched it up :)

Cheers,
Timothy

pooja
Nov 25, 2010, 4:05 AM
i have used AutoExpandColumn for grid panel. my grid works fine. but there is a small issue when i set the AutoExpandColumn property it leaves some space at the end of the grid. i have attached the image for more deatils.

aspx is as below:


<ext:FitLayout ID="FitLayout2" runat="server">
<ext:GridPanel ID="gpProduct" runat="server" StoreID="storeProductGrid" ClearEditorFilter="false"
AutoScroll="true" StripeRows="true" Height="290" Border="false" AutoExpandColumn="Item">
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column ColumnID="Category" Header="<%$ Resources:Portal_Product, GRIDCOLUMNCATAGORY %>" Sortable="true" DataIndex="CategoryCode" Hidden="true" >
</ext:Column>
<ext:Column ColumnID="Family" Header="<%$ Resources:Portal_Product, GRIDCOLUMNFAMILY %>" Width="200" Sortable="true" DataIndex="FamilyName">
</ext:Column>
<ext:Column Header="<%$ Resources:Portal_Product, GRIDCOLUMNTYPE %>" Width="200" Sortable="true" DataIndex="TypeName">
</ext:Column>
<ext:Column Header="<%$ Resources:Portal_Product, GRIDCOLUMNPRODUCT %>" Width="172" Sortable="true" DataIndex="ProductName">
</ext:Column>
<ext:Column ColumnID="Item" Header="<%$ Resources:Portal_Product, GRIDCOLUMNComponent %>" Width="175" Sortable="true" DataIndex="ItemName">
</ext:Column>
</Columns>
</ColumnModel>

<BottomBar>
<ext:PagingToolbar ID="PagingToolBar1" runat="server" PageSize="10" Width="750" />
</BottomBar>

</ext:GridPanel>
</ext:FitLayout>

Thanks
Pooja

geoffrey.mcgill
Nov 25, 2010, 4:56 AM
@pooja - Please start a new forum thread, and please wrap all code samples in [CODE] tags, see

http://forums.ext.net/showthread.php?3440-Forum-Guidelines-For-Posting-New-Topics