groupcommand handler parameters

  1. #1

    groupcommand handler parameters

    how can i change the command column icon upon the command's handler call? what parameters does the groupcommand handler accepts?
  2. #2
    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.Add);
            }
        }
    </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>
  3. #3
    What about Expand/Collapse event handler in this example? Is it possible to define one?
  4. #4
    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.
  5. #5
    This thread is related to
    http://forums.ext.net/showthread.php?12392

Similar Threads

  1. [CLOSED] Gridpanel GroupCommand Example
    By deejayns in forum 1.x Legacy Premium Help
    Replies: 11
    Last Post: Dec 31, 2011, 8:23 AM
  2. Replies: 1
    Last Post: Sep 28, 2011, 3:50 AM
  3. [CLOSED] Fn vs Handler (when to use Fn and Handler)
    By hgouw in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Sep 21, 2011, 1:39 AM
  4. [CLOSED] GroupCommand on a row with an ampersand in the name...
    By sadaf in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 19, 2011, 10:58 AM
  5. [CLOSED] Button AJAX Event and Handler Parameters
    By amitpareek in forum 1.x Help
    Replies: 3
    Last Post: Sep 17, 2008, 6:48 PM

Tags for this Thread

Posting Permissions