Feb 07, 2011, 4:56 PM
Hi,
AutoHeight is not always possible because some layouts require size for the container (like HBox, VBox, Fit)
Please see the following sample
Index
AutoHeight is not always possible because some layouts require size for the container (like HBox, VBox, Fit)
Please see the following sample
Index
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Import Namespace="Ext.Net.MVC" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Panel ID="Panel1" runat="server">
<Items>
<ext:TabPanel ID="TabPanel1" runat="server" AutoHeight="true">
<Items>
<ext:Panel
ID="homeTab"
runat="server"
Title="Home"
AutoHeight="true"
>
<AutoLoad Url="/Test/HomeTab" NoCache="true" ShowMask="true">
<Params>
<ext:Parameter
Name="containerId"
Value="function () {
return #{homeTab}.id;
}"
Mode="Raw" />
</Params>
</AutoLoad>
</ext:Panel>
<ext:Panel ID="Panel2" runat="server" Title="Another tab" />
</Items>
</ext:TabPanel>
</Items>
</ext:Panel>
</body>
</html>
HomeTab<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<ext:Panel ID="homeTabLayoutWrapper" runat="server" Layout="column">
<LayoutConfig>
<ext:ColumnLayoutConfig FitHeight="false" />
</LayoutConfig>
<Items>
<ext:Panel
ID="homeGrid"
runat="server"
ColumnWidth="1"
AutoHeight="true">
<AutoLoad Url="/Test/HomeGrid" ShowMask="true">
<Params>
<ext:Parameter
Name="containerId"
Value="function () {
return #{homeGrid}.id;
}" Mode="Raw" />
</Params>
</AutoLoad>
</ext:Panel>
<ext:Panel ID="Panel1" runat="server" Width="200" Layout="accordion">
<Items>
<ext:Panel ID="Panel2" runat="server" Title="Events" Html="Events" />
<ext:Panel ID="Panel3" runat="server" Title="Photos" Html="Photos" />
</Items>
</ext:Panel>
</Items>
</ext:Panel>
HomeGrid<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
Store store = this.GridPanel1.GetStore();
store.DataSource = new object[]
{
new object[] {"test1"},
new object[] {"test2"},
new object[] {"test3"},
new object[] {"test4"},
new object[] {"test5"},
new object[] {"test6"},
new object[] {"test7"},
new object[] {"test8"},
new object[] {"test9"}
};
store.DataBind();
}
}
</script>
<ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true">
<Store>
<ext:Store ID="Store1" runat="server">
<Reader>
<ext:ArrayReader>
<Fields>
<ext:RecordField Name="test" />
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column Header="Test" DataIndex="test" />
</Columns>
</ColumnModel>
<BottomBar>
<ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="3" />
</BottomBar>
</ext:GridPanel>
Controllerusing System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using Ext.Net.MVC.Demo.Models;
namespace Ext.Net.MVC.Demo.Controllers
{
public class TestController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult HomeTab(string containerId)
{
Ext.Net.MVC.PartialViewResult pr = new Ext.Net.MVC.PartialViewResult(containerId, RenderMode.AddTo);
pr.ControlToRender = "homeTabLayoutWrapper";
return pr;
}
public ActionResult HomeGrid(string containerId)
{
Ext.Net.MVC.PartialViewResult pr = new Ext.Net.MVC.PartialViewResult(containerId, RenderMode.AddTo);
pr.SingleControl = true; //alternative of .ControlToRender if there is only one top control.
return pr;
}
}
}