PDA

View Full Version : groupcommand handler parameters



wp_joju
Dec 08, 2010, 9:40 AM
how can i change the command column icon upon the command's handler call? what parameters does the groupcommand handler accepts?

Daniil
Dec 08, 2010, 3:40 PM
Hi,


what parameters does the groupcommand handler accepts?

If you put "debugger" in GroupCommand's Handler

<GroupCommand Handler="debugger;" />

You will see something like this:

fn: function(command,groupId,records){debugger;}


how can i change the command column icon upon the command's handler call?

This can look something like this (a little bit hard coded):

Example

<%@ 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)
{
Store store = this.GridPanel1.Store.Primary;
store.DataSource = new object[] {
new object[] {"test11", "test121", "test131"},
new object[] {"test11", "test122", "test132"},
new object[] {"test11", "test123", "test133"},
new object[] {"test21", "test221", "test231"},
new object[] {"test21", "test222", "test232"},
new object[] {"test21", "test223", "test233"},
new object[] {"test31", "test321", "test331"},
new object[] {"test31", "test322", "test332"},
new object[] {"test31", "test323", "test333"}
};
store.DataBind();

ResourceManager.GetInstance().RegisterIcon(Icon.Ad d);
}
}
</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 runat="server">
<title>Ext.Net Example</title>

<script type="text/javascript">
var endsWith = function(source, toTest) {
return (source.match(toTest + "$") == toTest)
}

var groupCommandHandler = function(command, groupId, records) {
var groups = GridPanel1.getView().getGroups(),
group;

Ext.each(groups, function(g) {
if (endsWith(g.id, groupId)) {
group = g;
return false;
}
});

Ext.fly(group).child("button").removeClass("icon-accept");
Ext.fly(group).child("button").addClass("icon-add");
}
</script>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true">
<Store>
<ext:Store runat="server" GroupField="test1">
<Reader>
<ext:ArrayReader>
<Fields>
<ext:RecordField Name="test1" />
<ext:RecordField Name="test2" />
<ext:RecordField Name="test3" />
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column Header="Test1" DataIndex="test1" />
<ext:Column Header="Test2" DataIndex="test2" />
<ext:Column Header="Test3" DataIndex="test3" />
<ext:CommandColumn Hidden="true">
<GroupCommands>
<ext:GridCommand CommandName="command1" Icon="Accept" />
</GroupCommands>
</ext:CommandColumn>
</Columns>
</ColumnModel>
<Listeners>
<GroupCommand Fn="groupCommandHandler" />
</Listeners>
<View>
<ext:GroupingView runat="server" />
</View>
</ext:GridPanel>
</form>
</body>
</html>

deejayns
Feb 15, 2011, 7:27 PM
What about Expand/Collapse event handler in this example? Is it possible to define one?

Daniil
Feb 15, 2011, 8:53 PM
Hi,

Please start a new thread on Premium help. If you feel that these threads are related please feel free to cross link between both.

Daniil
Feb 16, 2011, 10:22 AM
This thread is related to
http://forums.ext.net/showthread.php?12392