[CLOSED] CheckboxSelectionModel is not working when using filter

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] CheckboxSelectionModel is not working when using filter

    Hi,

    We have used CheckboxSelectionModel in our coolite grid along with filter in header for each column, when i have selected few rows and do filter and then remove filter the rows which got filter and came back does not selected.

    Coolite version : 0.8.2.983

    Scenario.
    There are 10 rows and first two row is selected using checkbox, and do the filter, the first two selected rows gets filtered which is fine, but when we remove filter those first two row comes back but without selection, but the requirement is to keep the selection persistence even when filtering is applied.

    Appreciate early response.

    Thanks
    Last edited by Daniil; Jan 09, 2011 at 12:11 PM. Reason: [CLOSED]
  2. #2
    Hi russ,

    Please specify ReaderID for Store's reader and set SelectionMemory to "Enabled" for GridPanel.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Ext.IsAjaxRequest)
            {
                this.Store1.DataSource = new object[] 
                {
                    new object[] {"test1"},
                    new object[] {"test2"},
                    new object[] {"test3"},
                    new object[] {"test4"},
                    new object[] {"test5"},
                    new object[] {"test6"},
                    new object[] {"test7"},
                    new object[] {"test8"},
                    new object[] {"test9"}
                };
                this.Store1.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>Coolite 0.8.X Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ScriptManager runat="server" />
        <ext:Store ID="Store1" runat="server">
            <Reader>
                <ext:ArrayReader ReaderID="test">
                    <Fields>
                        <ext:RecordField Name="test" />
                    </Fields>
                </ext:ArrayReader>
            </Reader>
        </ext:Store>
        <ext:GridPanel 
            ID="GridPanel1" 
            runat="server" 
            StoreID="Store1" 
            AutoHeight="true" 
            SelectionMemory="Enabled">
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column Header="Test" DataIndex="test" />
                </Columns>
            </ColumnModel>
            <SelectionModel>
                <ext:CheckboxSelectionModel runat="server" />
            </SelectionModel>
            <Plugins>
                <ext:GridFilters runat="server">
                    <Filters>
                        <ext:StringFilter DataIndex="test" />
                    </Filters>
                </ext:GridFilters>
            </Plugins>
        </ext:GridPanel>
        </form>
    </body>
    </html>
  3. #3
    Since store gets data from webservice i have been using JSON Reader instead of ArrayReader, and i tried your solution with my JSON reader without any luck, any suggestion on JSON reader will be appreciated.
  4. #4
    Since store gets data from webservice i have been using JSON Reader instead of ArrayReader, and i tried your solution with my JSON reader without any luck, any suggestion on JSON reader will be appreciated.


    Quote Originally Posted by Daniil View Post
    Hi russ,

    Please specify ReaderID for Store's reader and set SelectionMemory to "Enabled" for GridPanel.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Ext.IsAjaxRequest)
            {
                this.Store1.DataSource = new object[] 
                {
                    new object[] {"test1"},
                    new object[] {"test2"},
                    new object[] {"test3"},
                    new object[] {"test4"},
                    new object[] {"test5"},
                    new object[] {"test6"},
                    new object[] {"test7"},
                    new object[] {"test8"},
                    new object[] {"test9"}
                };
                this.Store1.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>Coolite 0.8.X Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ScriptManager runat="server" />
        <ext:Store ID="Store1" runat="server">
            <Reader>
                <ext:ArrayReader ReaderID="test">
                    <Fields>
                        <ext:RecordField Name="test" />
                    </Fields>
                </ext:ArrayReader>
            </Reader>
        </ext:Store>
        <ext:GridPanel 
            ID="GridPanel1" 
            runat="server" 
            StoreID="Store1" 
            AutoHeight="true" 
            SelectionMemory="Enabled">
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column Header="Test" DataIndex="test" />
                </Columns>
            </ColumnModel>
            <SelectionModel>
                <ext:CheckboxSelectionModel runat="server" />
            </SelectionModel>
            <Plugins>
                <ext:GridFilters runat="server">
                    <Filters>
                        <ext:StringFilter DataIndex="test" />
                    </Filters>
                </ext:GridFilters>
            </Plugins>
        </ext:GridPanel>
        </form>
    </body>
    </html>
  5. #5
    Hi,

    Please provide us with the markup of JSONReader.

    Please note that value of ReaderID must be the same as the one of names of RecordFields.
  6. #6
    Hi Daniil,

    The example which you posted i tried that by converting into JSON reader it does not work.
  7. #7
    Hi,

    Well, it also needs to change data structure that you bind to Store. There must be a list/array of objects in case with JSONReader.

    Example
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
     
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Ext.IsAjaxRequest)
            {
                this.Store1.DataSource = new object[]
                {
                    new {test = "test1"},
                    new {test = "test2"},
                    new {test = "test3"},
                    new {test = "test4"},
                    new {test = "test5"},
                };
                this.Store1.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>Coolite 0.8.X Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ScriptManager runat="server" />
        <ext:Store ID="Store1" runat="server">
            <Reader>
                <ext:JsonReader ReaderID="test">
                    <Fields>
                        <ext:RecordField Name="test" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>
        <ext:GridPanel
            ID="GridPanel1"
            runat="server"
            StoreID="Store1"
            AutoHeight="true"
            SelectionMemory="Enabled">
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column Header="Test" DataIndex="test" />
                </Columns>
            </ColumnModel>
            <SelectionModel>
                <ext:CheckboxSelectionModel runat="server" />
            </SelectionModel>
            <Plugins>
                <ext:GridFilters runat="server">
                    <Filters>
                        <ext:StringFilter DataIndex="test" />
                    </Filters>
                </ext:GridFilters>
            </Plugins>
        </ext:GridPanel>
        </form>
    </body>
    </html>
  8. #8
    Thanks, it solved my problem, appreciate your quick response and solution.
  9. #9
    When i try to retrieve all selected record from grid using "grid.selModel.getSelections()" it returns rows selected which are visible only not the rows which are selected but hidden because of filter ?
  10. #10
    Hi,

    No, it's not because of filter. It's default behavior - filtering resets selections of grid's selection model.

    There is the special mechanism in Coolite to save and restore these selections. Ids of selected rows are saved in the .selectedIds property of grid. So, you could use this property in according to your own needs.
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 3
    Last Post: Nov 05, 2013, 9:34 AM
  2. Not working: filter search, drop-down list
    By andersgunnare in forum 1.x Help
    Replies: 4
    Last Post: Jun 07, 2011, 6:45 PM
  3. Replies: 1
    Last Post: Aug 13, 2010, 5:09 PM
  4. [CLOSED] CheckboxSelectionModel not working..
    By Satyanarayana murthy in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Nov 20, 2009, 11:01 AM
  5. Replies: 4
    Last Post: Jun 22, 2009, 7:16 AM

Posting Permissions