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
Code:
<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?
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
Code:
<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
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
RE: GridPanel getting Cell Values in RowSelection
Code:
<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>
Code:
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.
RE: GridPanel getting Cell Values in RowSelection
Hi,
Your parameter Name is 'Values' *but you use in ExtraParams the 'Value'.
Please synchronize names
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!!