Feb 16, 2015, 4:59 PM
[CLOSED] ImageCommandColumn prepareCommand fires twice
Below is a scaled down version of GridPanel -> Commands -> Prepare_Commands. I placed a debugger in the javascript fn prepareCommand. There are two data rows, but the function fires four times.
I can see that the call stack is different the second time through, but I am not sure what to make of it.
I can see that the call stack is different the second time through, but I am not sure what to make of it.
<%@ 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 = 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" },
};
this.Store1.DataBind();
}
}
</script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Prepare Commands - Ext.NET Examples</title>
<link href="/resources/css/examples.css" rel="stylesheet" />
<script>
//in PrepareCommand we can modify command
var prepareCommand = function (grid, command, record, row) {
debugger;
};
</script>
</head>
<body>
<form runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Store ID="Store1" runat="server">
<Model>
<ext:Model 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>
<ext:GridPanel
runat="server"
StoreID="Store1"
Title="Row commands"
Width="800"
Height="300">
<ColumnModel runat="server">
<Columns>
<ext:Column runat="server" Text="Company" DataIndex="company" Flex="1" />
<ext:Column runat="server" Text="Price" Width="100" DataIndex="price">
<Renderer Format="UsMoney" />
</ext:Column>
<ext:Column runat="server" Text="Change" Width="75" DataIndex="change" />
<ext:Column runat="server" Text="Change" Width="75" DataIndex="pctChange" />
<ext:DateColumn runat="server" Text="Last Updated" Width="85" DataIndex="lastChange" />
<ext:ImageCommandColumn runat="server" Width="100" Text="Image Cmds">
<Commands>
<ext:ImageCommand Icon="Delete" CommandName="Delete" ToolTip-Text="Delete" />
</Commands>
<PrepareCommand Fn="prepareCommand" />
<Listeners>
<Command Handler="Ext.Msg.alert(command, record.data.company);" />
</Listeners>
</ext:ImageCommandColumn>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel runat="server" Mode="Single" />
</SelectionModel>
</ext:GridPanel>
</form>
</body>
</html>
Last edited by Daniil; Feb 18, 2015 at 10:53 AM.
Reason: [CLOSED]