[CLOSED] GridPanel - CheckboxSelectionModel - Set selected rows in a DirectEvent

  1. #1

    [CLOSED] GridPanel - CheckboxSelectionModel - Set selected rows in a DirectEvent

    Hi again, I have a GridPanel with a CheckboxSelectionModel. When the gridview is loaded no row is setted to selected.
    But, I have a button to set the selected rows.

    Here is the gridpanel:

    <ext:GridPanel 
                                runat="server" 
                                ID="GridPanel1" 
                                Frame="true"
                                MaxHeight="600"
                                MinHeight="300" >
                                <Store>
                                    <ext:Store 
                                        ID="Store1" 
                                        runat="server" 
                                        RemoteSort="true" ClearOnPageLoad="true" 
                                        PageSize="25" OnReadData="LeerTablaClientesExtNet_Refresh">
                                        <Model>
                                            <ext:Model ID="Model1" runat="server" IDProperty="ID_CLIENTE">
                                                <Fields>
                                                    <ext:ModelField Name="NOMBRE_CLIENTE" Type="String" />
                                                    <ext:ModelField Name="ID_CLIENTE" Type="Int" />
                                                </Fields>
                                            </ext:Model>
                                        </Model>
                                        <Sorters>
                                            <ext:DataSorter Property="LastName" Direction="ASC" />
                                        </Sorters>
                                    </ext:Store>
                                </Store>
                                <ColumnModel ID="ColumnModel1" runat="server">
                                    <Columns>
                                        <ext:Column ID="Column2" runat="server" Text="Nombre" DataIndex="NOMBRE_CLIENTE" Flex="1"  />
                                    </Columns>
                                </ColumnModel>
                                <Features>
                                    <ext:GridFilters runat="server" ID="GridFilters1" Local="true">
                                        <Filters>
                                            <ext:ListFilter DataIndex="TIPO" Options="Cliente, Proveedor, Contacto" />
                                            <ext:StringFilter DataIndex="CODIGO_AGENCIA" />
                                            <ext:StringFilter DataIndex="NOMBRE_CLIENTE" />
                                            <ext:StringFilter DataIndex="PaisNombre" />
                                            <ext:StringFilter DataIndex="NOMBRE_CONTACTO_PRINCIPAL" />
                                            <ext:StringFilter DataIndex="MAILS_PREDETERMINADOS" />
                                            <ext:StringFilter DataIndex="TELEFONOS_OFICINA" />
                                            <ext:StringFilter DataIndex="TELEFONOS_PREDETERMINADOS_CONTACTOS" />
                                            <ext:StringFilter DataIndex="PAGINA_WEB" />
                                            <ext:StringFilter DataIndex="CATEGORIAS" />
                                        </Filters>
                                    </ext:GridFilters>
                                </Features>
                                <SelectionModel>
                                    <ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server" Mode="Multi" />
                                </SelectionModel>       
                                <Buttons>
                                    <ext:Button ID="btnRecuperarListaCorreo" runat="server" Text="Recuperar clientes en la lista de correo" Icon="EmailOpen">
                                        <DirectEvents>
                                            <Click OnEvent="RecuperarListaCorreo"></Click>
                                        </DirectEvents>
                                    </ext:Button>
                                </Buttons>
                            </ext:GridPanel>
    And the direct event:

    Public Sub RecuperarListaCorreo(ByVal sender As Object, ByVal e As Ext.Net.DirectEventArgs)
    
            Dim sm As CheckboxSelectionModel = GridPanel1.GetSelectionModel()
    
            Try
    
                Dim InterfazBD As New Negocio.InterfazClientes()
    
                Dim listaCorreoGuardada As Object = InterfazBD.RecuperarListaCorreo()
    
                For Each cliente In listaCorreoGuardada
                    CheckboxSelectionModel1.SelectedRows.Add(New SelectedRow(cliente.ID_CLIENTE.ToString))
                Next
    
            Catch ex As Exception
                MostrarPanelMensaje("alert alert-error", "Error enviando el newsletter. Error: " & ex.Message)
            End Try
    
        End Sub
    But no rows are checked. The thing is that I put that code in the page_load, it set the selected rows fine.

    Any ideas?
    Last edited by Daniil; Sep 06, 2013 at 3:24 AM. Reason: [CLOSED]
  2. #2
    Hi @jamesand,

    If you change a SelectedRows collection during a DirectEvent, please call a CheckboxSelectionModel's UpdateSelection method to get the changes applied. As here:
    https://examples2.ext.net/#/GridPane...Row_Selection/
  3. #3
    Ok it works fine now. Thank you Daniil.

Similar Threads

  1. How to get selected rows CheckboxSelectionModel
    By lasantha in forum 1.x Help
    Replies: 5
    Last Post: Sep 26, 2015, 8:26 AM
  2. Replies: 4
    Last Post: Jul 30, 2013, 5:29 PM
  3. Replies: 7
    Last Post: Mar 12, 2013, 8:15 AM
  4. Replies: 1
    Last Post: Oct 13, 2010, 11:09 PM
  5. Replies: 2
    Last Post: Dec 25, 2009, 2:56 PM

Tags for this Thread

Posting Permissions