The child row will not delete. I have the Activation and Selection enabled on the parent of the grid. These cannot be set on the child. Here is the parent behaviors:
<Behaviors> <ig:Activation Enabled="true"> </ig:Activation> <ig:Sorting> </ig:Sorting> <ig:Selection CellClickAction="Row" RowSelectType="Single"> </ig:Selection> <ig:EditingCore> <Behaviors> <ig:RowDeleting Enabled="true" /> <ig:CellEditing> <ColumnSettings> <ig:EditingColumnSetting ColumnKey="DESCRIPTION" /> <ig:EditingColumnSetting ColumnKey="USES_SCORING" EditorID="ddpYesNoSelection" /> </ColumnSettings> <EditModeActions EnableOnActive="True" MouseClick="Single" /> </ig:CellEditing> <ig:RowAdding Alignment="Top"> <ColumnSettings> <ig:RowAddingColumnSetting ColumnKey="DESCRIPTION" /> <ig:RowAddingColumnSetting ColumnKey="USES_SCORING" EditorID="ddpYesNoSelection" /> </ColumnSettings> <EditModeActions EnableOnActive="True" MouseClick="Single" /> </ig:RowAdding> </Behaviors> </ig:EditingCore> </Behaviors>
Here is the child behavoirs:
<Behaviors> <ig:EditingCore EnableInheritance="True"> <Behaviors> <ig:CellEditing> <ColumnSettings> <ig:EditingColumnSetting ColumnKey="RANK" EditorID="nepSpinControl" ReadOnly="True" /> <ig:EditingColumnSetting ColumnKey="NAME" /> <ig:EditingColumnSetting ColumnKey="RATING_VALUE" EditorID="nepTypedNumeric" /> </ColumnSettings> <EditModeActions EnableOnActive="True" MouseClick="Single" /> </ig:CellEditing> <ig:RowAdding Alignment="Top"> <ColumnSettings> <ig:RowAddingColumnSetting ColumnKey="RANK" EditorID="nepSpinControl" /> <ig:RowAddingColumnSetting ColumnKey="NAME" /> <ig:RowAddingColumnSetting ColumnKey="RATING_VALUE" EditorID="nepTypedNumeric" /> </ColumnSettings> <AddNewRowClientEvents ExitingEditMode="whdgRatings_RowAdding_ExitingEditMode" EnteredEditMode="whdgRatings_RowAdding_EnteredEditMode" /> <EditModeActions EnableOnActive="True" MouseClick="Single" /> </ig:RowAdding> <ig:RowDeleting Enabled="true" /> </Behaviors> </ig:EditingCore> <ig:Sorting> </ig:Sorting> </Behaviors>
Here is the function that is called on both parent and child rows from a templated image button on the row.
function
DeleteRow() {
alert(selectedRows.get_length());
}
Any ideas??
Hi mdelgado,
var selectedRows = grid.get_gridView().get_behaviors().get_selection().get_selectedRows(); is only the selected rows for the main grid view. If you are trying to find the selected row in the child, you would have to get the child row island's selection behavior. All selection behaviors do have a method to return an array of selected collections for all grids. When deleting, you will also need to need the rows collection .remove() method on the child grid or the row deleting behavior on the child grid's delete method. Let me know if you need further assistance.
regards,
David Young
I did look for a gridView of some sort off the GridRow so far it is not evident to me how this is done. Do you have a code snippet that can steer me in the right direction.
Hi mdelegado,
Every row object in JS has a get_rowIslands() property. This returns an array of row islands, if the row has any. Once you index into it, it is another JS container gird object that has access to its behaviors, rows, columns, etc.
So to get the first child grid, you would do
var hGrid = $find("WHDG1");
var childGrid = hGrid.get_gridView().get_rows().get_row(0).get_rowIslands()[0];
-Dave
Excellent this works but now i have a different issue. I get an error on the postback which states: Request record cannot be found by key. The key is a composite key on Rank_Set_id and Rank. The update and add behaviors work just fine. I am assigning a dataset to the datasource. The keys/relations are as follows:
ds.Tables[0].TableName =
"RATINGS";
ds.Tables[0].PrimaryKey =
new DataColumn[] { ds.Tables[0].Columns["RATING_SET_ID"] };
ds.Tables[1].TableName =
"RATING_SET";
ds.Tables[1].PrimaryKey =
new DataColumn[] { ds.Tables[1].Columns["RATING_SET_ID"], ds.Tables[1].Columns["RANK"] };
ds.Relations.Add (
"RATINGS_FK" , ds.Tables[0].Columns["RATING_SET_ID"] , ds.Tables[1].Columns["RATING_SET_ID"] );