Checkboxselectionmodel and checkall

  1. #1

    Checkboxselectionmodel and checkall

    Hi,

    Is there an easy way to check in code behind if the checkall checkbox is checked?

    Regards
  2. #2
    Hi,

    There is no such property on server side.

    I'd suggest the following way.

    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)
            {
                Store store = this.GridPanel1.GetStore();
                store.DataSource = new object[] 
                { 
                    new object[] { "test11", "test12", "test13" },
                    new object[] { "test12", "test22", "test23" },
                    new object[] { "test13", "test32", "test33" }
                };
                store.DataBind();
            }
        }
    
        protected void SelectedAll(object sender, DirectEventArgs e)
        {
            X.Msg.Alert("DirectEvent", e.ExtraParams["selectedAll"]).Show();
        }
    </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>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true">
            <Store>
                <ext:Store 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>
            <SelectionModel>
                <ext:CheckboxSelectionModel runat="server" />
            </SelectionModel>
        </ext:GridPanel>
        <ext:Button runat="server" Text="Selected all?">
            <DirectEvents>
                <Click OnEvent="SelectedAll">
                    <ExtraParams>
                        <ext:Parameter 
                            Name="selectedAll" 
                            Value="GridPanel1.selModel.getCount() === GridPanel1.store.getCount()" 
                            Mode="Raw" />
                    </ExtraParams>
                </Click>
            </DirectEvents>
        </ext:Button>
        </form>
    </body>
    </html>
  3. #3
    Hi Daniil,

    Thanx a lot, but this will not solve my problem, because i'm using remote paging. So the getcount of the selection model will be for example 20, but the count of my store is 900.
    It is for that reason that i want to check if the checkall is selected.
    I want to avoid that the user needs to navigate through all the pages and select the checkall for each page.

    Regards
  4. #4

Similar Threads

  1. HideCheckAll CheckboxSelectionModel
    By sysmo in forum 2.x Help
    Replies: 4
    Last Post: Dec 14, 2012, 12:03 PM
  2. CheckboxSelectionModel
    By nomz in forum 1.x Help
    Replies: 9
    Last Post: Oct 31, 2011, 12:11 PM
  3. Replies: 1
    Last Post: Mar 26, 2011, 5:43 PM
  4. [CLOSED] CheckboxSelectionModel
    By pank in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 14, 2009, 5:59 AM
  5. [CLOSED] CheckboxSelectionModel Checkall as Standard
    By macap in forum 1.x Legacy Premium Help
    Replies: 11
    Last Post: Aug 05, 2009, 9:17 AM

Posting Permissions