Can we have CheckboxSelectionModel for a grid which uses Infinte Scrolling?

  1. #1

    Can we have CheckboxSelectionModel for a grid which uses Infinte Scrolling?

    I have a grid which uses infinite scrolling method of data binding. I am using OnReadData event to manipulate the data to be bound to the grid.
    And also I have CheckboxSelectionModel for the grid, somehow I am not able to select the checkboxes in it. I would like to know whether CheckboxSelectionModel works with infinte scrolling.
  2. #2
    Hello!

    I've tried the following example and it works:

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Store_ReadData(object sender, StoreReadDataEventArgs e)
        {
            Store store = (Store)sender;
            List<StockQuotation> data = new List<StockQuotation>();
            
            int start = e.Start,
                limit = e.Limit;
            Random randow = new Random();
            DateTime now = DateTime.Now;
            
            for (int i = start + 1; i <= start + limit; i++)
            {
                StockQuotation qoute = new StockQuotation()
                {
                    Company = "Company " + i,
                    Price = randow.Next(0, 200),
                    LastUpdate = now
                };
                
                data.Add(qoute);
            }
            store.Data = data;
            e.Total = 50000;
        }
    
        class StockQuotation
        {
            public string Company  { get; set; }
            public int Price { get; set; }
            public DateTime LastUpdate { get; set; }
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Infinite Scrolling - Ext.NET Examples</title>
        <link href="/resources/css/examples.css" rel="stylesheet" />
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            
            <h1>Infinite Scrolling</h1>
    
            <p>Ext.Net 2's brand new grid supports infinite scrolling, which enables you to load any number of records into a grid without paging.</p>
            
            <p>The new grid uses a virtualized scrolling system to handle potentially infinite data sets without any impact on client side performance.</p>
            
            <ext:GridPanel 
                runat="server" 
                Width="500" 
                Height="500"
                
                Title="Stock Price">
                <Store>
                    <ext:Store 
                        runat="server" 
                        Buffered="true" 
                        PageSize="200" 
                        TrailingBufferZone="10"
                        LeadingBufferZone="10"
                        OnReadData="Store_ReadData">
                        <Proxy>
                            <ext:PageProxy>
                                <Reader>
                                    <ext:JsonReader Root="data" />
                                </Reader>
                            </ext:PageProxy>
                        </Proxy>
                        <Model>
                            <ext:Model runat="server">
                                <Fields>
                                    <ext:ModelField Name="Company" />
                                    <ext:ModelField Name="Price" />
                                    <ext:ModelField Name="LastUpdate" />
                                </Fields>
                            </ext:Model>
                        </Model>
                    </ext:Store>
                </Store>
                <SelectionModel>
                    <ext:CheckboxSelectionModel runat="server"></ext:CheckboxSelectionModel>
                </SelectionModel>
                <ColumnModel runat="server">
    		        <Columns>
                        <ext:RowNumbererColumn 
                            runat="server" 
                            Width="50" />
                        <ext:Column 
                            runat="server" 
                            Text="Company" 
                            DataIndex="Company" 
                            Flex="1" />
                        <ext:Column 
                            runat="server" 
                            Text="Price, $" 
                            DataIndex="Price" 
                            Width="70" 
                            Align="Center" />
                        <ext:Column 
                            runat="server" 
                            Text="Last Update" 
                            DataIndex="LastUpdate" 
                            Width="140">
                            <Renderer Format="Date" FormatArgs="'n/j/Y g:i:s A'" />
                        </ext:Column>
    		        </Columns>
                </ColumnModel>           
                <View>
                    <ext:GridView runat="server" TrackOver="false" />
                </View>                        
            </ext:GridPanel>
        </form>
    </body>
    </html>

Similar Threads

  1. [CLOSED] Grid scrolling without the scrollbar
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Nov 18, 2016, 6:58 PM
  2. Replies: 5
    Last Post: Dec 14, 2012, 5:07 PM
  3. [CLOSED] Infinite scrolling grid select row and focus
    By ASAPCH in forum 2.x Legacy Premium Help
    Replies: 8
    Last Post: Oct 26, 2012, 6:27 PM
  4. [CLOSED] Scrolling to a programmatically selected row in a grid
    By blueworld in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Oct 04, 2012, 12:33 PM
  5. Replies: 5
    Last Post: Sep 03, 2012, 1:38 PM

Posting Permissions