[CLOSED] Javascript after the Grid's Refresh event is done

  1. #1

    [CLOSED] Javascript after the Grid's Refresh event is done

    How do I run a Javascript from the Codebehind after the Grid's Refresh event is done?
    Last edited by Daniil; Dec 14, 2011 at 4:24 AM. Reason: [CLOSED]
  2. #2
    Hi,

    You can use:

    1. Refresh DirectEvent

    or

    2. Refresh listener + DirectMethod.
  3. #3
    Can you share an example please.

    Thanks a lot for the help.
  4. #4
    Here you are.

    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)
            {
                this.Store1.DataSource = new object[] 
                { 
                    new object[] { "test1", "test2", "test3" },
                    new object[] { "test4", "test5", "test6" },
                    new object[] { "test7", "test8", "test9" },
                };
                this.Store1.DataBind();
            }
        }
    
        protected void Grid_Refresh(object sender, DirectEventArgs e)
        {
            Ext.Net.GridView view = sender as Ext.Net.GridView;
            X.Js.Call("onRefresh", new JRawValue(view.ClientID));
        }
    </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 onRefresh = function (view) {
                var grid = view.grid;
                Ext.Msg.alert("Refresh", grid.id + " is refreshed");
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true">
                <Store>
                    <ext:Store ID="Store1" runat="server">
                        <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" />
                    </Columns>
                </ColumnModel>
                <View>
                    <ext:GridView runat="server">
                        <DirectEvents>
                            <Refresh OnEvent="Grid_Refresh" />
                        </DirectEvents>
                    </ext:GridView>
                </View>
            </ext:GridPanel>
        </form>
    </body>
    </html>
  5. #5
    Thanks a lot Daniil.
    Looks like this may not be the solution to my problem. I am trying to "Select All" the rows (CheckColumn in the Grid), on click of a button, on the page where I am using Remote Paging also.

    Any sample/example will be of great help.
  6. #6

    Solution Found but Performance is a HIT

    I found the solution to the problem at:
    http://forums.ext.net/showthread.php...k-in-GridPanel

    But it's really slow, any performace tips?
  7. #7
    I'm not sure about your requirement, but, I think, it's not related to the initial question of the thread which was answered.

    I'm going to close the current thread.

    Please start a new one with more details.

Similar Threads

  1. Replies: 12
    Last Post: Aug 03, 2012, 1:49 PM
  2. Replies: 2
    Last Post: Feb 08, 2012, 2:56 PM
  3. [CLOSED] Refresh PagingToolbar using Javascript
    By speedstepmem4 in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Oct 20, 2010, 8:33 AM
  4. [CLOSED] [1.0] Grid Store Refresh Event behavior overriding
    By webclouder in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 25, 2010, 9:40 AM
  5. [CLOSED] Tab refresh from Javascript
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Mar 23, 2010, 7:13 PM

Posting Permissions