How To Get Selected Row Data

  1. #1

    [CLOSED]

    Hello everyone,

    I'm facing an issue for get the selected row data from a GridPanel.

    When I click the button, I can get the SelectedRow from this way below:

    ((Ext.Net.RowSelectionModel)(GridSolicitacoes.Sele ctionModel.Primary)).SelectedRow

    But how can I get the values? I would retrieve the CodigoSolicitacao field value or an ID to search for the item

    Thanks for any help

    This is my grid:

    <ext:GridPanel ID="GridSolicitacoes" runat="server" StripeRows="true" Title="Solicitações"
                Icon="Table" TrackMouseOver="true" Width="760" Height="350" Frame="true" ButtonAlign="Right">
                <Store>
                    <ext:Store ID="StoreSolicitacoes" runat="server" OnRefreshData="MyData_Refresh">
                        <Reader>
                            <ext:JsonReader>
                                <Fields>
                                    <ext:RecordField Name="CodigoSolicitacao" Mapping="CodigoSolicitacao" Type="String" />
                                    <ext:RecordField Name="Nome" Mapping="Nome" Type="String" />
                                    <ext:RecordField Name="DataSolicitacao" Mapping="DataSolicitacao" Type="Date" />
                                    <ext:RecordField Name="DescrTipoSolicitacao" Mapping="DescrTipoSolicitacao" Type="String" />
                                </Fields>
                            </ext:JsonReader>
                        </Reader>
                    </ext:Store>
                </Store>
                <ColumnModel ID="ColumnModel1" runat="server">
                    <Columns>
                        <ext:Column ColumnID="CodigoSolicitacao" Header="Solicitação" DataIndex="CodigoSolicitacao"
                            Width="100" />
                        <ext:Column ColumnID="Nome" Header="Responsável" DataIndex="Nome" Width="250" />
                        <ext:DateColumn ColumnID="DataSolicitacao" Header="Data" DataIndex="DataSolicitacao"
                            Width="150" Format="dd/MM/yyyy" />
                        <ext:Column ColumnID="DescrTipoSolicitacao" Header="Tipo" DataIndex="DescrTipoSolicitacao"
                            Width="150" />
                        <ext:ImageCommandColumn Width="25" ColumnID="Select">
                            <Commands>
                                <ext:ImageCommand CommandName="btnSelecionar" Icon="Add" Text="">
                                    <ToolTip Title="Selecionar" Text="Seleciona a Solicitação Desejada." />
                                </ext:ImageCommand>
                            </Commands>
                        </ext:ImageCommandColumn>
                    </Columns>
                </ColumnModel>
                <SelectionModel>
                    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true" />
                </SelectionModel>
                <DirectEvents>
                    <Command OnEvent="LinhaGrid_DirectClick">
                        <EventMask ShowMask="true" MinDelay="10" />
                        <ExtraParams>
                            <ext:Parameter Value="record.data.IdSolicitacao" Mode="Raw" Name="IdSolicitacao">
                            </ext:Parameter>
                            <ext:Parameter Value="command" Mode="Raw" Name="IdSolicitacao">
                            </ext:Parameter>
                        </ExtraParams>
                    </Command>
                </DirectEvents>
                <BottomBar>
                    <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="5" EmptyMsg="Não existem dados para serem mostrados.">
                        <Items>
                            <ext:ToolbarSpacer ID="ToolbarSpacer1" runat="server" Width="10" />
                            <ext:ComboBox ID="cboPageSize" runat="server" Width="150" FieldLabel="Registros por página">
                                <Items>
                                    <ext:ListItem Text="1" />
                                    <ext:ListItem Text="5" />
                                    <ext:ListItem Text="10" />
                                    <ext:ListItem Text="15" />
                                    <ext:ListItem Text="20" />
                                    <ext:ListItem Text="100" />
                                </Items>
                                <SelectedItem Value="15" />
                                <Listeners>
                                    <Select Handler="#{PagingToolbar1}.pageSize = parseInt(this.getValue()); #{PagingToolbar1}.doLoad();" />
                                </Listeners>
                            </ext:ComboBox>
                        </Items>
                    </ext:PagingToolbar>
                </BottomBar>
            </ext:GridPanel>
    Last edited by marcoslimagon; Oct 26, 2011 at 1:46 PM. Reason: Closed
  2. #2
    Also, the RecordId Property is returning a negative value, so I can't use it to find the data from database
  3. #3
    There's a new question http://forums.ext.net/showthread.php...selectionmodel

    regarding the same issue
  4. #4
    I have found the solution by myself...


    <ext:Store ID="StoreSolicitacoes" runat="server" OnRefreshData="MyData_Refresh" AutoLoad="true" IDMode="Explicit">
                        <Reader>
                            <ext:JsonReader  IDProperty="CodigoSolicitacao">
                                <Fields>
                                    <ext:RecordField Name="CodigoSolicitacao" Mapping="CodigoSolicitacao" Type="String" />
                                    <ext:RecordField Name="Nome" Mapping="Nome" Type="String" />
                                    <ext:RecordField Name="DataSolicitacao" Mapping="DataSolicitacao" Type="Date" />
                                    <ext:RecordField Name="DescrTipoSolicitacao" Mapping="DescrTipoSolicitacao" Type="String" />
                                </Fields>
                            </ext:JsonReader>
                        </Reader>
                    </ext:Store>

    To get the Record Id I can use...

    ((Ext.Net.RowSelectionModel)(this.GridSolicitacoes.SelectionModel.Primary)).SelectedRow.RecordID
    Regards, I hope this thread can help you :)

    Marcos Lima
    Software Developer/Tech Lead
    www.marcoslimagon.com.br
    Last edited by marcoslimagon; Oct 28, 2011 at 11:19 AM.

Similar Threads

  1. [CLOSED] Access to selected gridpanel row data
    By HOWARDJ in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 11, 2011, 7:07 AM
  2. Replies: 1
    Last Post: Nov 17, 2010, 12:42 PM
  3. Replies: 3
    Last Post: Aug 21, 2010, 5:26 AM
  4. Replies: 3
    Last Post: Jun 30, 2010, 7:53 PM
  5. Replies: 2
    Last Post: Dec 25, 2009, 2:56 PM

Tags for this Thread

Posting Permissions