[CLOSED] Gridcommand listener and Rowselection directevent

  1. #1

    [CLOSED] Gridcommand listener and Rowselection directevent

    Hi,

    is there a way to call a javascript function on a GridCommand or ImageCommand inside a Grid
    without calling the directevent associated to the rowselection as well?

    I mean. I have this Grid:

              <ext:GridPanel runat="server" ID="templategrid" AutoScroll="true" StoreID="TemplateStore" Height="400">
                <ColumnModel>
                    <Columns>
    
                        <ext:CommandColumn ID="colEditTemplate" Width="25" runat="server" OverOnly="True">
                            <Commands>
                                <ext:GridCommand Icon="Pencil" CommandName="cmdEditTemplate">
                                    <ToolTip Text="<%$ I18n: EditText %>" />
                                </ext:GridCommand>
                            </Commands>
                            <Listeners>
                                <Command Handler="return testfunction(record, command); return false;"></Command>
    
                            </Listeners>
                </ext:CommandColumn>
    
                        <%--Fields for List Mode--%>
                        <ext:Column ID="colId" runat="server" DataIndex="Id" Hidden="True"  />
                        <ext:Column ID="colDescription" runat="server" DataIndex="Description" Header="<%$ I18n: Label_Description %>" Width="400" Groupable="true" Sortable="true" MenuDisabled="False" />               
                    </Columns>
                </ColumnModel>
                <%--Selection Model--%>
                <SelectionModel>
                    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" Mode="Single">
                        <DirectEvents>
                            <Select OnEvent="GetTemplateBlocks">
                                <EventMask ShowMask="true" />
                                <ExtraParams>
                                    <ext:Parameter Name="TemplateId" Value="record.data.Id" Mode="Raw" />
                                </ExtraParams>
                            </Select>
                        </DirectEvents>
                    </ext:RowSelectionModel>
                </SelectionModel>
            </ext:GridPanel>
    When I click the gridcommand icon, the testfunction in javascript is called but is called also the code behind directevents GettemplateBlocks
    of the row selection.
    Is there a way to avoid this? I would like that when I click the GridCommand only the javascript testfunction is executed.

    Thanks
    Last edited by Daniil; Jul 17, 2013 at 3:23 PM. Reason: [CLOSED]
  2. #2
    Hi @alessandra.monica,

    Please demonstrate the "testfunction" definition. Do you not select a row inside it?

    The Select event doesn't fire if click a GridCommand in this test case.

    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.GetStore();
                store.DataSource = new object[] 
                { 
                    new object[] { "test1", "test2", "test3" },
                    new object[] { "test4", "test5", "test6" },
                    new object[] { "test7", "test8", "test9" }
                };
            }
        }
    
        protected void OnSelect(object sender, DirectEventArgs e)
        {
            X.Msg.Alert("OnSelect", "Hello from Server!").Show();
        }
    </script>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:GridPanel ID="GridPanel1" runat="server">
                <Store>
                    <ext:Store runat="server">
                        <Model>
                            <ext:Model runat="server">
                                <Fields>
                                    <ext:ModelField Name="test1" />
                                    <ext:ModelField Name="test2" />
                                    <ext:ModelField Name="test3" />
                                </Fields>
                            </ext:Model>
                        </Model>
                    </ext:Store>
                </Store>
                <ColumnModel runat="server">
                    <Columns>
                        <ext:Column runat="server" Text="Test1" DataIndex="test1" />
                        <ext:Column runat="server" Text="Test2" DataIndex="test2" />
                        <ext:Column runat="server" Text="Test3" DataIndex="test3" />
                        <ext:CommandColumn ID="colEditTemplate" Width="25" runat="server" OverOnly="True">
                            <Commands>
                                <ext:GridCommand Icon="Pencil" CommandName="cmdEditTemplate">
                                </ext:GridCommand>
                            </Commands>
                            <Listeners>
                                <Command Handler="console.log('Command');"></Command>
                            </Listeners>
                        </ext:CommandColumn>
    
                    </Columns>
                </ColumnModel>
                <SelectionModel>
                    <ext:RowSelectionModel runat="server" Mode="Single">
                        <DirectEvents>
                            <Select OnEvent="OnSelect" />
                        </DirectEvents>
                    </ext:RowSelectionModel>
                </SelectionModel>
            </ext:GridPanel>
        </form>
    </body>
    </html>
  3. #3
    Hi Daniil,
    sorry for the late.

    tesfunction contains simply an alert javascript, nothing more, just for example.

    In any case I have tried your example but here every time I click the pencil, the OnSelect
    function server-side is called (so the row is "selected")

    Which version are you using to test?

    Thanks
  4. #4
    I was able to reproduce it with the v2.2 release.

    However, it is not reproducible with the trunk. Could you update from the SVN trunk?
  5. #5
    Hi Daniil,

    I have updated with the trunk and indeed it works, OnSelect is not called anymore.

    Do you know when the Ext.Net version 2.3 will be available for download?

    Thanks
  6. #6
    The official v2.3 release should happen very soon. Maybe, even this week. The next week should be for sure.

    Do you not want to use the trunk?
  7. #7
    Quote Originally Posted by Daniil View Post
    The official v2.3 release should happen very soon. Maybe, even this week. The next week should be for sure.

    Do you not want to use the trunk?
    We prefer to use the official released version :-)))
    We will wait for it, no problem!

    Thank you very much.

    You can close the thread!

Similar Threads

  1. [CLOSED] Mask for MenuItem click on listener (not DirectEvent)
    By cwolcott in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: May 02, 2013, 2:34 PM
  2. Replies: 4
    Last Post: Apr 09, 2013, 4:03 PM
  3. [CLOSED] DirectEvent/Listener on TextField as you type
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Mar 15, 2012, 4:47 PM
  4. Add DirectEvent listener to dynamic TabPanel
    By JerryThorpe in forum 1.x Help
    Replies: 2
    Last Post: Oct 11, 2011, 7:19 PM
  5. [CLOSED] Need RowEditor ValidateEdit Listener and DirectEvent Example
    By SFritsche in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 24, 2010, 3:28 AM

Posting Permissions