GridPanel getting Cell Values in RowSelection

  1. #1

    GridPanel getting Cell Values in RowSelection

    I have used the following code from the 'Selection Models > RowSelection' example but it does not work for my Grid

    <ext:Button runat="server" Text="Submit selection">
        <AjaxEvents>
            <Click OnEvent="SubmitSelection">
                <ExtraParams>
                    <ext:Parameter Name="Values" Value="Ext.encode(#{GridPanel1}.getRowsValues())" Mode="Raw" />
                </ExtraParams>
            </Click>
        </AjaxEvents>
    </ext:Button>
    e.ExtraParams["Value"] contains nothing.

    I have checked the code in my application and there is one difference and I need to know if this is the reason.

    Because the data in my Grid is dependant on a composite key (i.e. two columns make up the unique ID) I do not have a ReaderID value on my Store so when I select a row I need to get the values of the two ID cells. Would this stop it working? If so what other way can I get the values of these cells?
  2. #2

    RE: GridPanel getting Cell Values in RowSelection

    I tried to Edit this post but I kept getting an error so I had to reply instead.

    When I try this method

        <AjaxEvents>
              <CellDblClick OnEvent="DblClick">
                    <UserParams>
                         <ext:Parameter Name="Value" Value="getValue(params[0],params[1],params[2])" Mode="Raw" />
                    </UserParams>
              </CellDblClick>
        </AjaxEvents>
    I get an error in the script
  3. #3

    RE: GridPanel getting Cell Values in RowSelection

     Hi,

    Please note that getRowsValues return only selected rows values by default (you can return all rows if pass 'false' to the function). So, if you don't have selection when this function called then you get emty value


    If you want get only selected rows then you must have RowSelectionModel




    If these conditions are met then please post full code to investigate


  4. #4

    RE: GridPanel getting Cell Values in RowSelection


    <ext:GridPanel ID="historyGrid" runat="server" 
        StoreID="historyStore" 
        Title="Change History"     
        Header="true" 
        AutoHeight="false"
        AutoExpandColumn="ChangeDesc" 
        StripeRows="true"
        Icon="TableMultiple"
        StyleSpec="margin-top:5px;"
        TrackMouseOver="true">
    
    <ColumnModel ID="ColumnModel2">
        <Columns>
            <ext:Column ColumnID="EffectiveDate" 
                                Header="Effective Date" 
                                DataIndex="EffectiveDate" Sortable="false" MenuDisabled="true" Width="90">
                <Renderer Fn="Ext.util.Format.dateRenderer('d-m-Y')" />
            </ext:Column>
            <ext:Column ColumnID="ChangeDesc" Header="P Change" DataIndex="ChangeDescription" 
                                    Sortable="false" MenuDisabled="true" />
            <ext:Column ColumnID="Status" Header="Status" DataIndex="StatusDescription" Sortable="false"
                                    MenuDisabled="true" Width="110"/>
            <%-- Hidden columns--%>
            <ext:Column ColumnID="DetailID" Header="" DataIndex="ChangeTypeDetailID" 
                                   Sortable="false" Hidden="true" MenuDisabled="true" /> 
            <ext:Column ColumnID="EmployeeID" Header="" DataIndex="EmployeeID" 
                                    Sortable="false" Hidden="true" MenuDisabled="true" /> 
            <ext:Column ColumnID="StatusID" Header="Status ID" DataIndex="StatusID" 
                                        Sortable="false" Hidden="true" MenuDisabled="true" />
        </Columns>
    </ColumnModel>
    
    
    
    
    
    <View>
        <ext:GridView ForceFit="true" />
    </View>
    
    <SelectionModel>
        <ext:RowSelectionModel runat="server" SingleSelect="true">
            <AjaxEvents>
                <RowSelect OnEvent="historyGrid_RowSelect">
                    <ExtraParams>
                        <ext:Parameter Name="Values" Value="Ext.encode(#{historyGrid}.getRowsValues())" Mode="Raw" />
                    </ExtraParams>
                </RowSelect>
            </AjaxEvents> 
        </ext:RowSelectionModel>
    </SelectionModel>

    public void historyGrid_RowSelect(object sender, AjaxEventArgs e)
    {
        string x = e.ExtraParams["Value"];
    
        // x is empty
    }
    As you can see I used RowSelect event, but I also tried using a Button and calling the same code from there to be sure that the selection of the row was complete.

    I don't want all the rows only the selected row. I am providing a separate dialogue window to edit the data instead of in-grid editing.
  5. #5

    RE: GridPanel getting Cell Values in RowSelection

    Hi,

    Your parameter Name is 'Values'  but you use in ExtraParams the 'Value'.
    Please synchronize names


  6. #6

    RE: GridPanel getting Cell Values in RowSelection

    I am so sorry!

    I try to make sure I have double checked everything before I post to the Forum. This was so simple!!

Similar Threads

  1. set rowselection in gridpanel
    By HansWapenaar in forum 2.x Help
    Replies: 0
    Last Post: Jul 24, 2012, 2:24 PM
  2. GridPanel Get row cell values
    By naina in forum 1.x Help
    Replies: 7
    Last Post: Mar 10, 2012, 4:14 AM
  3. Replies: 1
    Last Post: Oct 24, 2011, 3:14 AM
  4. [CLOSED] Rowselection is executed when Selecting a Grid cell
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 09, 2011, 9:13 AM
  5. [CLOSED] Clear RowSelection in GridPanel
    By speedstepmem4 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 16, 2010, 11:57 PM

Posting Permissions