PDA

View Full Version : [CLOSED] How can I get the Loading Message to fire 'On Change' of a Tab in a TabStrip ??



Fahd
Jul 06, 2012, 5:55 PM
<ext:TabStrip ID="TabStrip1" runat="server" EnableTabScroll="true">
<Loader runat="server">
<LoadMask Msg="Loading Data" ShowMask="true" />
</Loader>
</ext:TabStrip>


The above code gives a Javascript Error.
The bottom code works, but I want to add a Loading Message when the Tab is Changed.



<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
this.Store1.DataSource = this.Data;
this.Store1.DataBind();

var lines = new List<string>() { "Line 1", "Line 2", "Line 3", "Line 4" };
int i = 1;
foreach (var line in lines)
{
/* NEW Tab */
var tabStripItem = new Tab
{
TabID = @"_" + i,
Text = line,
ToolTip = line
};


TabStrip1.Listeners.TabChange.Handler = "App.direct.LoadActiveTab(tab.id, tab.text);";
TabStrip1.Items.Add(tabStripItem);
i++;
}
}
}

[DirectMethod]
public void LoadActiveTab(string id, string text)
{

var title = "ID #: " + id.Remove(0, 1);
X.Msg.Notify(title, text).Show();
}

private object[] Data
{
get
{
return new object[]
{
new object[] { "3m Co", 71.72, 0.02, 0.03, "9/1 12:00am" },
new object[] { "Alcoa Inc", 29.01, 0.42, 1.47, "9/1 12:00am" },
new object[] { "Altria Group Inc", 83.81, 0.28, 0.34, "9/1 12:00am" },
new object[] { "Wal-Mart Stores, Inc.", 45.45, 0.73, 1.63, "9/1 12:00am" }
};
}
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Simple Array Grid - Ext.NET Examples</title>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Panel ID="Panel1" runat="server" Layout="FitLayout" AutoScroll="false">
<Items>
<ext:Container ID="MainContainer" runat="server" Layout="Column" Height="510" AutoScroll="false"
AutoDoLayout="true">
<Items>
<ext:Container ID="Container1" runat="server" Width="463">
<Items>
<ext:Panel ID="Panel2" runat="server" Border="false">
<Items>
<ext:TabStrip ID="TabStrip1" runat="server" EnableTabScroll="true" />
<ext:GridPanel ID="GridPanel1" runat="server" Title="Array Grid" Width="600" Height="175">
<Store>
<ext:Store ID="Store1" runat="server">
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="company" />
<ext:ModelField Name="price" Type="Float" />
<ext:ModelField Name="change" Type="Float" />
<ext:ModelField Name="pctChange" Type="Float" />
<ext:ModelField Name="lastChange" Type="Date" DateFormat="M/d hh:mmtt" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:Column ID="Column1" runat="server" Text="Company" DataIndex="company" Flex="1" />
<ext:Column ID="Column2" runat="server" Text="Price" DataIndex="price">
</ext:Column>
<ext:Column ID="Column3" runat="server" Text="Change" DataIndex="change">
</ext:Column>
<ext:Column ID="Column4" runat="server" Text="Change" DataIndex="pctChange">
</ext:Column>
<ext:DateColumn ID="DateColumn1" runat="server" Text="Last Updated" DataIndex="lastChange" />
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
</SelectionModel>
<DockedItems>
<ext:Container ID="Container2" runat="server" Dock="Bottom">
<Content>
<table align="center">
<tr>
<td>
<table border="0">
<tr>
<td>
<b>Testing HTML</b>
</td>
</tr>
</table>
</td>
</tr>
</table>
</Content>
</ext:Container>
</DockedItems>
</ext:GridPanel>
</Items>
</ext:Panel>
</Items>
</ext:Container>
<ext:Container ID="Container3" runat="server" ColumnWidth=".58">
<Items>
<ext:Label ID="Label1" runat="server" Text="Other form">
</ext:Label>
</Items>
</ext:Container>
</Items>
</ext:Container>
</Items>
</ext:Panel>
</body>
</html>

Daniil
Jul 08, 2012, 9:02 PM
Hi,

You can show the mask for any component:

Ext.net.Mask.show({
el : App.Panel2
})
and hide

Ext.net.Mask.hide();