[CLOSED] Getting and setting the current page of a grid panel based on the selected row.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] Getting and setting the current page of a grid panel based on the selected row.

    I have a grid panel that is loaded with say 40 items and the page size is set to 10. In code behind I am selecting a row based on a value from the database. As an example lets assume it is on page 3. I can set the grid to show page 3 in code behind using nameOfStore.LoadPage(3) which works. The problem is I can't figure out how to programatically determine the record index or page on which the selected row resides.
    This is the code behind that sets the selected row based on a rowID:
     Dim rowID As String = Nothing
         rowID = String.Format("{0}|{1}", "textKey", ID_in)
         Dim sm As CheckboxSelectionModel = grdComposite.GetSelectionModel
         sm.ClearSelection()
         sm.SelectedRows.Add(New SelectedRow(rowID))
    In all cases sm.SelectedIndex and sm.SelectedRow.RowIndex are always -1 and I don't see any other property that would tell me the row number of the record I selected. Once I have that I can use that and the PageSize to determine which page to load.

    This is some of the grid markup:
                <ext:GridPanel
                                            runat="server"
                                            ID="grdComposite"
                                            Title="Select a Composite Allocation"
                                            BodyPadding="15"
                                            Padding="10"
                                            HeightSpec="100%">
    
                                            <Store>
                                                <ext:Store
                                                    runat="server"
                                                    ID="strComposite"
                                                    PageSize="10">
                                                    <Model>
                                                        <ext:Model runat="server" IDProperty="RowID">
                                                            <Fields>
                                                                <ext:ModelField Name="RowID" Type="String" />
                                                                <ext:ModelField Name="CompositeID" Type="String" />
                                                                <ext:ModelField Name="CompositeName" />
                                                            </Fields>
                                                        </ext:Model>
                                                    </Model>
                                                       
                                                </ext:Store>
                                            </Store>
    
                                            <View>
                                                <ext:GridView
                                                        runat="server"
                                                        TrackOver="false"
                                                        EmptyText="No composites available.">
                                                    <GetRowClass Handler="return record.get('RangeClass');" />
                                                </ext:GridView>
                                            </View>
    
                                            <ColumnModel>
                                                <Columns>
                                                    <ext:Column
                                                            runat="server"
                                                            ColumnID="colCompositeName"
                                                            Header="Composite"
                                                            DataIndex="CompositeName"
                                                             
                                                            Flex="1"
                                                            MenuDisabled="true">
                                                    </ext:Column>
    
                                                </Columns>
                                            </ColumnModel>
                                                
                                            <SelectionModel>
                                                <ext:CheckboxSelectionModel
                                                        runat="server"
                                                        ID="grdCompositeSelectionModel"
                                                        AllowDeselect="false"
                                                        Mode="Single">
                                                    <DirectEvents>
                                                        <Select
                                                            OnEvent="grdCompositeSelectionModel_RowSelect" Before="maskInsightPanels(true)">
                                                            <ExtraParams>
                                                                <ext:Parameter Name="investmentid"  Value="record.getId()" Mode="Raw" />
                                                                <ext:Parameter Name="productminimums"  Value="record.productminimums" Mode="Raw" />
                                                                <ext:Parameter Name="Values" Value="Ext.encode(#{grdComposite}.getRowsValues({selectedOnly : true}))" Mode="Raw" />
                                                            </ExtraParams>
                                                        </Select>
                                                    </DirectEvents>
                                                </ext:CheckboxSelectionModel>
                                            </SelectionModel>
                                            <BottomBar>
                                                <ext:PagingToolbar runat="server" />
                                            </BottomBar>
                                        </ext:GridPanel>
    Last edited by fabricio.murta; Aug 11, 2017 at 7:56 PM.

Similar Threads

  1. Replies: 11
    Last Post: Feb 29, 2012, 3:57 PM
  2. Replies: 1
    Last Post: Nov 18, 2010, 5:21 AM
  3. Replies: 1
    Last Post: Nov 10, 2010, 8:47 PM
  4. [CLOSED] How to get the current node selected in a tree panel?
    By flormariafr in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Aug 13, 2010, 4:43 PM
  5. [CLOSED] Grouping doesn't group entire grid data...just current page.
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Mar 05, 2010, 2:34 PM

Posting Permissions