PDA

View Full Version : [CLOSED] Use ColumnIndex in GridPanel Client Side



speedstepmem4
Oct 29, 2013, 7:17 AM
Hi,

How can i use column index value for the following sample? It shows the error
Note: Is there any document/reference what are the parameters available in client side function for all controls?



<%@ 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();
}
}

protected void RefershData(object sender, StoreReadDataEventArgs e)
{
this.Store1.DataSource = this.Data;
this.Store1.DataBind();
}

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[] { "American Express Company", 52.55, 0.01, 0.02, "9/1 12:00am" },
new object[] { "American International Group, Inc.", 64.13, 0.31, 0.49, "9/1 12:00am" },
new object[] { "AT&T Inc.", 31.61, -0.48, -1.54, "9/1 12:00am" },
new object[] { "Boeing Co.", 75.43, 0.53, 0.71, "9/1 12:00am" },
new object[] { "Caterpillar Inc.", 67.27, 0.92, 1.39, "9/1 12:00am" },
new object[] { "Citigroup, Inc.", 49.37, 0.02, 0.04, "9/1 12:00am" },
new object[] { "E.I. du Pont de Nemours and Company", 40.48, 0.51, 1.28, "9/1 12:00am" }

};
}
}
</script>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<title>Simple Array Grid - Ext.NET Examples</title>
<link href="/resources/css/examples.css" rel="stylesheet" />
<script type="text/javascript">
function Show(colIndex) {
alert(colIndex);
}
</script>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<h1>
Simple Array Grid</h1>
<ext:GridPanel ID="GridPanel1" runat="server" Title="Array Grid" Width="600" Height="350">
<Store>
<ext:Store ID="Store1" runat="server" PageSize="5" OnReadData="RefershData">
<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>
<View>
<ext:GridView runat="server" LoadMask="true" LoadingText="Loading....">
</ext:GridView>
</View>
<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>
<Listeners>
<CellClick Handler="Show(columnIndex);">
</CellClick>
</Listeners>
</ext:GridPanel>
</body>
</html>

Daniil
Oct 29, 2013, 11:11 AM
Hi @speedstepmem4,

Please use "cellIndex".


Note: Is there any document/reference what are the parameters available in client side function for all controls?

Please use this:
http://examples2.ext.net/#/Events/Listeners/Arguments/


It shows the error

For the future: it is always good to provide more details about errors. At least, an error message.