[CLOSED] SortChange event calling two times

  1. #1

    [CLOSED] SortChange event calling two times

    Hi!

    I have written "SortChange" listener in grid, but it is calling two times while I click on any header cell of grid. How can I prevent it? Actually I want to sort it cusotom through code behind but its calling two times. I have also tried to apply "RemoteSort"="true" in store's property but it didn't help.


    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SortingIssue.aspx.cs" Inherits="ExtNetTest.Admin.SortingIssue" %>
    <!DOCTYPE html>
    <script runat="server"> 
    
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                this.store1.DataSource = new object[]
                {
                    
                    
                    new object[] {1,"1.0","Automatic","ABC XYZ","ABC ABC"},
                    new object[] {2,"1.0","Automatic","ABC PQR","PQR ABC"},
                    new object[] {3,"1.0","Automatic","QQQ AAA","AAA BBB"},
                    new object[] {4,"1.0","Automatic","QWE QWE","ASD ASD"},
                    new object[] {5,"1.0","Automatic","123123123 123123123","121212 121212"},
                    new object[] {6,"1.0","Automatic","123456789 12345","987654321 54321"},
                    new object[] {7,"1.0","Automatic","ZZZ CCC","AAA BBB"},
                    new object[] {8,"1.0","Automatic","EEE EEE","QWE QWE"},
                    new object[] {9,"1.0","Automatic","QQQ WWW RRR TTTT YYY UUU","QQQ WWW DDD FFF"},
                    new object[] {10,"1.0","Automatic","QQQQQ FFFF TTTTT YYYYY","QQQQQ FFFF TTTTT YYYYY"}
                };
    
                this.store1.DataBind();
            }
        }
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
          <ext:ResourceManager ID="ResourceManager1" runat="server" />
     
          <ext:GridPanel
            ID="grid1"
            runat="server"
            MultiSelect="true"
            Flex="1"
            Height="300"
            ForceFit="true"
            Anchor="100% 100%"
            Margins="0 0 0 3"
            RowLines="true"
            ColumnLines="true"
            IDMode="Static"
             
            >
            <Store>
                <ext:Store ID="store1" runat="server">
                    <Model>
                        <ext:Model ID="Model1" runat="server" IDProperty="ID">
                            <Fields>
                                <ext:ModelField Name="ID"></ext:ModelField>
                                <ext:ModelField Name="Rank"></ext:ModelField>
                                <ext:ModelField Name="Calculate"></ext:ModelField>
                                <ext:ModelField Name="BeforRow"></ext:ModelField>
                                <ext:ModelField Name="AfterRow"></ext:ModelField>
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
            </Store>
            <ColumnModel >
                <Columns>
                    <ext:NumberColumn ID="ColumnNumber" runat="server" Text="Rank" Hideable="false" DataIndex="Rank" Format="9.9" Width="50" MaxWidth="50" MinWidth="50" AnchorHorizontal="100" />
                     <ext:Column ID="Column17" runat="server" Text="Calculate" Hideable="false" DataIndex="Calculate" Width="80" MaxWidth="80" AnchorVertical="100" MinWidth="80"/>
                    <ext:Column ID="Column1" runat="server" Text="case" Flex="1"  Hideable="false">
                        <Columns>
                            
                            
                            <ext:Column ID="Column13" runat="server" Text="Befor" MinWidth="450" Hideable="false" DataIndex="BeforRow">
                            </ext:Column>
                            <ext:Column ID="Column14" runat="server" Text="After" MinWidth="450" MaxWidth="5000" Hideable="false" DataIndex="AfterRow" >
                            </ext:Column>
                        </Columns>
                    </ext:Column>
                </Columns>
            </ColumnModel>
              <Listeners>
                  <SortChange Handler="alert('Sorted!');" />
              </Listeners>
        </ext:GridPanel>
      
        </form>
    </body>
    </html>
    Thanks
    Last edited by Daniil; Nov 26, 2013 at 6:39 AM. Reason: [CLOSED]
  2. #2
    Hi @shaileshsakaria,

    If you need remote sorting (i.e. sorting on server), when RemoteSort="true" is really a way to go.

    You should configure a Store with a Proxy (PageProxy or AjaxProxy, for example). Here is an example with PageProxy.
    https://examples2.ext.net/#/GridPane.../DirectMethod/

Similar Threads

  1. Replies: 4
    Last Post: Apr 17, 2013, 2:14 PM
  2. [CLOSED] Event firing several times.
    By stoque in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 07, 2013, 8:05 AM
  3. SortChange Direct Event doesn't fire at all
    By cicaglisa in forum 1.x Help
    Replies: 1
    Last Post: May 23, 2012, 5:31 PM
  4. Replies: 3
    Last Post: Jan 13, 2012, 1:07 PM
  5. Calling AddScript multiple times?
    By dbassett74 in forum 1.x Help
    Replies: 4
    Last Post: May 14, 2009, 7:27 PM

Posting Permissions