[CLOSED] Select all grid rows in grid with paging

  1. #1

    [CLOSED] Select all grid rows in grid with paging

    Hi, how to select all grid rows in a grid with paging (in all pages)?

    I'm trying this, without success, only checks in first page gets selected.

    grdTitulos.getSelectionModel().selectRecords(grdTitulos.getStore().getAllRange(), true);
    I've seen this for version 2, but i'm using version 1.
    http://forums.ext.net/showthread.php?26559
    Last edited by Daniil; Jul 23, 2014 at 2:02 PM. Reason: [CLOSED]
  2. #2
    Hi @josegarcia,

    Could you, please, clarify whether you use remote or local paging?
  3. #3
    Local in this case.
  4. #4
    Here is an example.

    Example
    <%@ Page Language="C#" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                Store store = this.GridPanel1.GetStore();
                store.DataSource = new object[] 
                { 
                    new { test = "test1" },
                    new { test = "test2" },
                    new { test = "test3" },
                    new { test = "test4" },
                    new { test = "test5" },
                    new { test = "test6" },
                    new { test = "test7" },
                    new { test = "test8" },
                    new { test = "test9" }
                };
                
                store.DataBind();
            }
        }
    </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 selectAll = function () {
                var grid = GridPanel1,
                    store = grid.getStore(),
                    idProperty = grid.getStore().reader.meta.idProperty,
                    id;
    
                Ext.each(store.getAllRange(), function (rec, index) {                
                    id = rec.data[idProperty]; 
    
                    grid.selectedIds[id] = { 
                        id: id, 
                        index: index 
                    };
                }); 
                
                grid.getSelectionModel().selectAll();
            };
    
            var deselectAll = function () {
                var grid = GridPanel1;
    
                grid.selectedIds = {};
                grid.getSelectionModel().clearSelections();
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:Button runat="server" Text="Select all">
                <Listeners>
                    <Click Fn="selectAll" />
                </Listeners>
            </ext:Button>
    
            <ext:Button runat="server" Text="Deselect all">
                <Listeners>
                    <Click Fn="deselectAll" />
                </Listeners>
            </ext:Button>
    
            <ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true">
                <Store>
                    <ext:Store runat="server">
                        <Reader>
                            <ext:JsonReader IDProperty="test">
                                <Fields>
                                    <ext:RecordField Name="test" />
                                </Fields>
                            </ext:JsonReader>
                        </Reader>
                    </ext:Store>
                </Store>
                <ColumnModel runat="server">
                    <Columns>
                        <ext:Column Header="Test" DataIndex="test" />
                    </Columns>
                </ColumnModel>
                <SelectionModel>
                    <ext:RowSelectionModel runat="server" />
                </SelectionModel>
                <BottomBar>
                    <ext:PagingToolbar runat="server" PageSize="3" />
                </BottomBar>
            </ext:GridPanel>
        </form>
    </body>
    </html>

Similar Threads

  1. Replies: 8
    Last Post: Mar 01, 2013, 5:33 PM
  2. [CLOSED] select grid rows with ajax handler
    By hillscottc in forum 1.x Premium Help
    Replies: 3
    Last Post: May 07, 2010, 5:46 PM
  3. [CLOSED] select grid rows by checkbox selections
    By hillscottc in forum 1.x Premium Help
    Replies: 3
    Last Post: May 06, 2010, 8:17 PM
  4. Select rows in a Grid with a list of record Id
    By fquintero in forum 1.x Help
    Replies: 1
    Last Post: Dec 01, 2009, 5:14 PM
  5. Replies: 1
    Last Post: Oct 09, 2009, 4:46 AM

Tags for this Thread

Posting Permissions