GridPanel Selection Ajax Event

  1. #1

    GridPanel Selection Ajax Event

    Hi There,

    I have a GridPanel that is contained within a Panel:

                            <ext:GridPanel TrackMouseOver="true" ID="GridPanel1" StoreID="strCampaignStore" runat="server" StripeRows="true" Height="200">
                                <ColumnModel ID="ColumnModel2" runat="server">
                                    <Columns>
                                        <ext:Column ColumnID="CampaignName" DataIndex="CampaignName" Header="Campaign Name" Width="130">                                    
                                        </ext:Column>
                                        <ext:Column ColumnID="CampaignDescription" DataIndex="CampaignDescription" Header="Campaign Description" Width="260">
                                        </ext:Column>
                                         <ext:Column ColumnID="CampaignBody" DataIndex="CampaignBody" Header="Campaign Body" width="410">
                                        </ext:Column>
                                    </Columns>
                                </ColumnModel>  
                                <BottomBar>
                                    <ext:PagingToolBar ID="PagingToolBar1" runat="server" PageSize="10" StoreID="strCampaignStore" />
                                </BottomBar>
                                <SelectionModel>
                                    <ext:RowSelectionModel runat="server" SingleSelect="true">
                                        <AjaxEvents>
                                            <RowSelect OnEvent="RowSelect">
                                                <EventMask ShowMask="true" Target="CustomTarget" CustomTarget="#{pnDetails}" />
                                                <ExtraParams>
                                                    <ext:Parameter Name="CampaignID" Value="this.getSelected().id" Mode="Raw" />    
                                                </ExtraParams>
                                            </RowSelect>
                                        </AjaxEvents>
                                    </ext:RowSelectionModel>
                                </SelectionModel>
                            </ext:GridPanel>
    It has an AJAX selection model that fires when a row has been selected. This AJAX method then fires on the serverside to populate a form with the details supplied from the GridPanel.

    The problem is that this AJAXEvent seems to be firing at around 10 times a second. This keeps going and never stops. I have looked over the example GridPanel and Form combination that you have in the examples but I cannot see any difference.

    Any help would be greatfully recieved

    Thanks

    Sam
  2. #2

    RE: GridPanel Selection Ajax Event

    Never mind!

    My fault entirely, I was populating the data store on page load which was rebinding the data to the grid and re-firing the selection.

    Got to keep remembering to wrap my Page_Load with:

                if (!Ext.IsAjaxRequest)
                {
                }
    Thanks

    Sam
  3. #3

    RE: GridPanel Selection Ajax Event

    Hi,

    I'm expirencing exactly the same problems. I've tried both examples from
    Examples->GridPanel->Data with details.
    Both examples keep firing the "OnEvent" endlessly.

    In my case i have 2 Stores both coupled to its own Gridpanel. The first gridpanel is loaded in the codebehind Page_Load and has a SelectionChange (also tried RowSelect) that triggers the codebehind to databind the second store connected to the second GridPanel.

    ASP

    
    
    
    
    <ext:Store ID="Store1" runat="server">
        <Reader>
            <ext:ArrayReader ReaderID="DepartmentId">
                <Fields>
                    <ext:RecordField Name="DepartmentId" />
                    <ext:RecordField Name="DepartmentName"/>
                </Fields>
            </ext:ArrayReader>
        </Reader> 
    </ext:Store>
    <ext:Store ID="Store2" runat="server">
        <Reader>
            <ext:ArrayReader ReaderID="EmployeeId">
                <Fields>
                    <ext:RecordField Name="EmployeeId" />
                    <ext:RecordField Name="EmployeeName"/>
                </Fields>
            </ext:ArrayReader>
        </Reader> 
    </ext:Store> 
    
    
    
    
    
    <ext:GridPanel ID="GridPanel1" AutoWidth="true" StoreID="Store1" runat="server" Title="MyTitle" TrackMouseOver="true" AutoExpandColumn="DepartmentName" >
        <ColumnModel ID="ColumnModel1" runat="server">
            <Columns>
                <ext:Column ColumnID="DepartmentName" DataIndex="DepartmentName" Header="Afdeling" />
            </Columns>
        </ColumnModel>
        <SelectionModel>
            <ext:RowSelectionModel runat="server" SingleSelect="true" >
                <AjaxEvents> 
                    <SelectionChange OnEvent="LoadEmployees" Buffer="250" >
                        <EventMask ShowMask="true"/>
                        <ExtraParams> 
                             <ext:Parameter Name="Value" Value="this.getSelected().id" Mode="Raw" />
                        </ExtraParams>
                    </SelectionChange> 
               </AjaxEvents> 
            </ext:RowSelectionModel> 
         </SelectionModel> 
    </ext:GridPanel>

    Codebehind:


    
    
    
    
    protected void Page_Load(object sender, EventArgs e)
    {
    
    
        this.Store1.DataSource = new object[]
        {
            new object[] {"1", "Item1"},
            new object[] {"2", "Item2"},
            new object[] {"3", "Item3"},
            new object[] {"4", "Item4"},
        };
    
    
        this.Store1.DataBind();
    }
    
    
    
    
    protected void LoadEmployees(object sender, AjaxEventArgs e)
    { 
        string id = e.ExtraParams["Value"]; 
        if (id == "1")
        {
            this.Store2.DataSource = new object[]
            {
                new object[] {"1", "Item1"},
                new object[] {"2", "Item2"},
                new object[] {"3", "Item3"},
            };
            this.Store2.DataBind();
        }
        // other id implements  
    }
  4. #4

    RE: GridPanel Selection Ajax Event

    haha, just as i finished making this post.

    Thanks anyways for posting the solution!
  5. #5

    RE: GridPanel Selection Ajax Event

    Was it the same issue for you?
  6. #6

    RE: GridPanel Selection Ajax Event

    Yup, also needed to be wrapped, thnx.

Similar Threads

  1. Replies: 3
    Last Post: Oct 05, 2012, 11:44 AM
  2. Replies: 0
    Last Post: Sep 13, 2011, 6:59 AM
  3. Replies: 1
    Last Post: Feb 10, 2011, 8:27 AM
  4. Gridpanel - Force Save - then Ajax/Direct event?
    By Tbaseflug in forum 1.x Help
    Replies: 1
    Last Post: Nov 24, 2010, 11:04 AM
  5. [CLOSED] Before event of a ajax event.
    By Riset in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Nov 27, 2009, 12:07 PM

Posting Permissions