Select rows in a Grid with a list of record Id

  1. #1

    Select rows in a Grid with a list of record Id

    Hi guys,

    I have a question about the method SelectRecords in RowSelectionModel. I have a gridpanel linked with a store object.

    The datasource of the store is a simple object list with the properties Id and name.

        <ext:Store ID="store1" runat="server" >
                <Reader>
                    <ext:JsonReader ReaderID="Id"   >
                    <Fields>
                        <ext:RecordField Name="Id" Type="Int"></ext:RecordField>
                        <ext:RecordField Name="name"></ext:RecordField>
                    </Fields>
                    </ext:JsonReader>
               </Reader>
            </ext:Store>
    The grid code is this

                    <ext:GridPanel 
                                runat="server" 
                                ID="gridpanel1" 
                                StoreID="store1">
                                <ColumnModel ID="ColumnModel1" runat="server">
                                    <Columns>
                                        <ext:Column ColumnID="name" DataIndex="name" Header="NAME" ></ext:Column>
                                    </Columns>
                                 </ColumnModel>
                                <SelectionModel>
                                    <ext:CheckboxSelectionModel ID="CheckboxSelectionModel9" runat="server" HideCheckAll="true"  />
                                </SelectionModel> 
                   </ext:GridPanel>
    And I have a button with ajax event. The button should select an specific row in server side, not by row index, but by RecordID. Then I have this code in server side (VB.NET)

    
        Protected Sub selectARow(ByVal sender As Object, ByVal e As AjaxEventArgs)
            Dim selectionModel As RowSelectionModel = CType(Me.gridpanel1.SelectionModel.First, RowSelectionModel)
    
            selectionModel.SelectRecords(New Integer() {67}, True) '67 is the Id of an object in the datasource list of objects.
    
        End Sub
    But nothing happens, the specific record is not selected. If I use the next method, the second row is selected, but I don't need select rows by the order. I need select rows by their Record Id.

    
    
    
        Protected Sub selectARow(ByVal sender As Object, ByVal e As AjaxEventArgs)
    
            Dim selectionModel As RowSelectionModel = CType(Me.gridpanel1.SelectionModel.First, RowSelectionModel)
    
            selectionModel.SelectRow(1, True)
    
        End Sub

    How I can get it?


    Thanks!!!!



  2. #2

    RE: Select rows in a Grid with a list of record Id

    Hi,

    Yes, that function doesn't work in 0.8.1. It is fixed in 1.0 version (SelectById method)

Similar Threads

  1. Replies: 11
    Last Post: Mar 27, 2011, 5:26 PM
  2. [CLOSED] How to change record values of selected rows?
    By macap in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jul 30, 2010, 12:29 PM
  3. [CLOSED] select grid rows with ajax handler
    By hillscottc in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 07, 2010, 4:46 PM
  4. [CLOSED] select grid rows by checkbox selections
    By hillscottc in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 06, 2010, 7:17 PM
  5. [CLOSED] Select rows All in GridPanel
    By Hari_CSC in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 09, 2010, 1:58 PM

Posting Permissions