[CLOSED] grid checkbox selection

  1. #1

    [CLOSED] grid checkbox selection

    Still having trouble with checkbox selection
    click search button at bottom. (first page doesnt render). so paginate to the second.
    then start at the top and begin checking the boxes sequentially download (do it quickly). after 4-5, they get unselected.
    really odd.
    thanks,
    /Z

    <%@ Page Language="C#" AutoEventWireup="true"  %>
    
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    
    <!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 id="HeadPunchPairTask" runat="server">
        <title>sTasks</title>
    
    
        <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
         {
             if (!X.IsAjaxRequest)
             {
                 this.Store1.DataSource = new List<Company> 
                 { 
                     new Company(0, "3m Co", 71.72, 0.02, 0.03),
                     new Company(1, "Alcoa Inc", 29.01, 0.42, 1.47),
                     new Company(2, "Altria Group Inc", 83.81, 0.28, 0.34),
                     new Company(3, "American Express Company", 52.55, 0.01, 0.02),
                     new Company(4, "American International Group, Inc.", 64.13, 0.31, 0.49),
                     new Company(5, "AT&T Inc.", 31.61, -0.48, -1.54),
                     new Company(6, "Boeing Co.", 75.43, 0.53, 0.71),
                     new Company(7, "Caterpillar Inc.", 67.27, 0.92, 1.39),
                     new Company(8, "Citigroup, Inc.", 49.37, 0.02, 0.04),
                     new Company(9, "E.I. du Pont de Nemours and Company", 40.48, 0.51, 1.28),
                     new Company(10, "Exxon Mobil Corp", 68.1, -0.43, -0.64),
                     new Company(11, "General Electric Company", 34.14, -0.08, -0.23),
                     new Company(12, "General Motors Corporation", 30.27, 1.09, 3.74),
                     new Company(13, "Hewlett-Packard Co.", 36.53, -0.03, -0.08),
                     new Company(14, "Honeywell Intl Inc", 38.77, 0.05, 0.13),
                     new Company(15, "Intel Corporation", 19.88, 0.31, 1.58),
                     new Company(16, "International Business Machines", 81.41, 0.44, 0.54),
                     new Company(17, "Johnson & Johnson", 64.72, 0.06, 0.09),
                     new Company(18, "JP Morgan & Chase & Co", 45.73, 0.07, 0.15),
                     new Company(19, "McDonald\"s Corporation", 36.76, 0.86, 2.40),
                     new Company(20, "Merck & Co., Inc.", 40.96, 0.41, 1.01),
                     new Company(21, "Microsoft Corporation", 25.84, 0.14, 0.54),
                     new Company(22, "Pfizer Inc", 27.96, 0.4, 1.45),
                     new Company(23, "The Coca-Cola Company", 45.07, 0.26, 0.58),
                     new Company(24, "The Home Depot, Inc.", 34.64, 0.35, 1.02),
                     new Company(25, "The Procter & Gamble Company", 61.91, 0.01, 0.02),
                     new Company(26, "United Technologies Corporation", 63.26, 0.55, 0.88),
                     new Company(27, "Verizon Communications", 35.57, 0.39, 1.11),
                     new Company(28, "Wal-Mart Stores, Inc.", 45.45, 0.73, 1.63)
                 };
    
    
                 this.Store1.DataBind();
    
    
    
    
             }
        }
    
    
        public class Company
        {
            public Company(int id, string name, double price, double change, double pctChange)
            {
                this.ID = id;
                this.Name = name;
                this.Price = price;
                this.Change = change;
                this.PctChange = pctChange;
            }
    
    
            public int ID { get; set; }
            public string Name { get; set; }
            public double Price { get;set; }
            public double Change { get;set; }
            public double PctChange { get;set; }
        }
    </script>
        <script type="text/javascript">
      
                var template = '<span style="color:{0};">{1}</span>';
    
    
                var change = function (value) {
                    return Ext.String.format(template, (value > 0) ? "green" : "red", value);
                }
    
    
                var pctChange = function (value) {
                    return Ext.String.format(template, (value > 0) ? "green" : "red", value + "%");
                }
        </script>    
    </head>
    <body>
        <form id="FormSearchPunchPairTask" runat="server">
            <ext:ResourceManager ID="ResourceManager2" runat="server">
            </ext:ResourceManager>
            <ext:Viewport ID="Viewport1" runat="server" AutoScroll="True" Layout="FitLayout">          
                <Items>  
                    <ext:Panel Layout="CardLayout" runat="server" AutoWidth="true" ActiveIndex="0" ID="SearchCardContainer" Border="False">
                        <BottomBar>
                            <ext:Toolbar ID="ToolbarSearch8" runat="server">
                                <Items>
                                    <ext:Button ID="b1" runat="server" Text="Search Punch Pair Tasks" Icon="Find">
                                        <Listeners>
                                            <Click Handler="if (App.FormPanelSearchRequest.getForm().isValid()) {  App.GridPanelSearchResults.store.load(); App.SearchCardContainer.getLayout().setActiveItem(1);}"/>
                                        </Listeners>           
                                    </ext:Button>
                                    <ext:Button ID="Button1" runat="server" Text="ids" Icon="FilmStar">
                                        <Listeners>
                                            <Click Handler="alert (#{GridPanelSearchResults}.getSelectionMemory().selectedIds);"/>
                                        </Listeners>           
                                    </ext:Button>
                                </Items>
                            </ext:Toolbar>
                        </BottomBar>
    
    
                        <Items>
                            <ext:FormPanel 
                                ID="FormPanelSearchRequest" 
                                runat="server" 
                                Title="Search Options" 
                                AutoWidth="true"
                                Height="200"
                                BodyPadding="3"
                                CollapseMode="Default"
                                Collapsible="true"
                                Icon="ComputerGo"
                                >
                                <Items>
      
                                    <ext:ComboBox ID="dffdg"
                                        runat="server"
                                        Editable="false"
                                        FieldLabel="Has Tasks"
                                        IndicatorText="*" 
                                        IndicatorCls="red-text" 
                                        AllowBlank="true"
                                        EmptyText="Select an option...">
                                        <SelectedItems>
                                            <ext:ListItem  Index="0" /> 
                                        </SelectedItems> 
                                        <Items>
                                            <ext:ListItem Text="All" Value="" />
                                            <ext:ListItem Text="Yes" Value="true" />
                                            <ext:ListItem Text="No" Value="false" />
                                        </Items>
                                    </ext:ComboBox>
                            
                                </Items>
                            </ext:FormPanel>
                            <ext:GridPanel 
                                ID="GridPanelSearchResults" 
                                runat="server" 
                                Title="Tasks" 
                                Hidden="true"
                                AutoWidth="true"
                                AutoRender="true">
                                <Store>
                                    <ext:Store ID="Store1" runat="server" PageSize="10">
                                        <Model>
                                            <ext:Model ID="Model1" runat="server" IDProperty="ID">
                                                <Fields>
                                                    <ext:ModelField Name="ID" />
                                                    <ext:ModelField Name="Name" />
                                                    <ext:ModelField Name="Price" />
                                                    <ext:ModelField Name="Change" />
                                                    <ext:ModelField Name="PctChange" />
                                                </Fields>
                                            </ext:Model>
                                        </Model>
                                    </ext:Store>
                                </Store>
                                 <ColumnModel ID="ColumnModel1" runat="server">
                                    <Columns>
                                        <ext:Column ID="Column1" runat="server" Text="Company" DataIndex="Name" Flex="1" />
                                        <ext:Column ID="Column2" runat="server" Text="Price" Width="75" DataIndex="Price">
                                            <Renderer Format="UsMoney" />
                                        </ext:Column>
                                        <ext:Column ID="Column3" runat="server" Text="Change" Width="75" DataIndex="Change">
                                            <Renderer Fn="change" />
                                        </ext:Column>
                                        <ext:Column ID="Column4" runat="server" Text="Change" Width="75" DataIndex="PctChange">
                                            <Renderer Fn="pctChange" />
                                        </ext:Column>
                                    </Columns>
                                </ColumnModel>
                                <View>
                                    <ext:GridView StripeRows="true" runat="server" />
                                </View>
                                <SelectionModel>
                                    <ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server" />                   
                                </SelectionModel>
                                <BottomBar>
                                    <ext:PagingToolbar ID="PagingToolbar2" 
                                        runat="server" 
                                        DisplayInfo="true" 
                                        DisplayMsg="Displaying results {0} - {1} of {2}" 
                                        EmptyMsg="No results to display">
                                        <Items>
                                            <ext:Label ID="Label1" runat="server" Text="Page size:" />
                                            <ext:ToolbarSpacer ID="ToolbarSpacer1" runat="server" Width="5" />
                                            <ext:ComboBox ID="ComboBoxPaging" runat="server" Width="50" Editable="false">
                                                <Items>
                                                    <ext:ListItem Text="50" />
                                                    <ext:ListItem Text="100" />
                                                    <ext:ListItem Text="250" />
                                                    <ext:ListItem Text="500" />
                                                </Items>
                                                <SelectedItems><ext:ListItem Value="50" /></SelectedItems>
                                                <ListConfig Width="50" />
                                                <Listeners>
                                                    <Select Handler="#{StoreSearchResults}.pageSize = parseInt(this.getValue()); #{PagingToolbar1}.getStore().load();writeBrowserCookie('defaultPagingSize', this.getValue());" />
                                                </Listeners>
                                            </ext:ComboBox>
                                        </Items>
                                    </ext:PagingToolbar>
                                </BottomBar>
                            </ext:GridPanel>
                        </Items>
                    </ext:Panel>
                </Items>
            </ext:Viewport>
    
    
            <ext:KeyMap ID="KeyMap1" runat="server" Target="FormPanelSearchRequest">
                <Binding>
                    <ext:KeyBinding Handler="Ext.getCmp('b1').fireEvent('click')">
                        <Keys>
                            <ext:Key Code="ENTER"/>
                        </Keys>
                    </ext:KeyBinding>
                </Binding>
            </ext:KeyMap>
    
    
        </form>
    
    
    </body>
    </html>
    Last edited by Daniil; Sep 04, 2015 at 5:51 PM. Reason: [CLOSED]
  2. #2
    Hi @Z,

    I guess it gets unselected if you click outside of a checkbox. There is a small "non-checkbox" area in a CheckboxSelectionModel Column. If click there, it is not treated as a click on Checkbox. It is a known issue.
    https://github.com/extnet/Ext.NET/issues/122

    To get Ext.NET v1 behavior, please set Mode="Simple" for CheckboxSelectionModel.
  3. #3
    Thxs. I will use the Simple mode. This bug makes the multi mode unuseable.
    /Z
  4. #4
    I tend to agree with you, but this also makes sense:
    https://www.sencha.com/forum/showthr...l=1#post928337

    As for a config option @evant talked about, I don't see it implemented.
  5. #5
    I think you also missed part of my original issue. If I already checked 5 records, when I "miss" it unchecked ALL the previous 5 also.

    /Z
  6. #6
    Well, it is how Multi mode works. If you don't hold a Ctrl key, a regular row click unchecks all the previous selection. A regular row click happens if miss a checkbox.

Similar Threads

  1. [CLOSED] CheckBox Selection in Editable Grid
    By speedstepmem4 in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 10, 2014, 12:10 PM
  2. Replies: 2
    Last Post: Apr 21, 2014, 8:24 AM
  3. Replies: 10
    Last Post: Apr 19, 2013, 3:16 PM
  4. Replies: 4
    Last Post: Mar 26, 2013, 2:09 AM
  5. grid with grouping and checkbox selection
    By [WP]joju in forum 1.x Help
    Replies: 1
    Last Post: Sep 30, 2009, 11:05 AM

Posting Permissions