is there a way to select all items in a group on clientside? I tried the following code but without any success.
Best regards,
Dominic
The Grid:
<
telerik:RadGrid ID="radGrid" AllowMultiRowSelection="true" ...>
<MasterTableView ...>
<GroupByExpressions>
<telerik:GridGroupByExpression>
<SelectFields>
<telerik:GridGroupByField FieldAlias="Zyklus" FieldName="Cycle" HeaderValueSeparator=": ">
</telerik:GridGroupByField>
</SelectFields>
<GroupByFields>
<telerik:GridGroupByField FieldName="Cycle" />
</GroupByFields>
</telerik:GridGroupByExpression>
</GroupByExpressions>
<Columns>
<telerik:GridClientSelectColumn UniqueName="appliedColumn" HeaderText="verabreicht" />
...
Inside the ItemDataBound Event
if
( e.Item is GridGroupHeaderItem )
{
GridGroupHeaderItem item = ( GridGroupHeaderItem )e.Item;
CheckBox check = new CheckBox();
check.ID =
"CheckAll";
check.Attributes.Add(
"onclick", "headerClick(this)");
check.Text =
"Auswahl aller Anwendungen des Zyklus umkehren.";
item.DataCell.Controls.Add( check );
}
The Javascipt:
function
headerClick(e)
{
var masterTable = $find( "ctl00_MasterContent_therapyFormView_tumourTherapy_therapyRadGrid" ).get_masterTableView();
var element = $(e).parent().parent().parent();
var children = $(element).find("~ tr");
for (var a = 0; a<children.length;a++)
{
if ($(children[a]).attr("class") == "rgRow" || $(children[a]).attr("class") == "rgAltRow" || $(children[a]).attr("class") == "rgRow rgSelectedRow" || $(children[a]).attr("class") == "rgAltRow rgSelectedRow")
{
if( e.checked ) {
masterTable.selectItem( $(children[a])[0] );
}
else {
masterTable.deselectItem( $(children[a])[0] );
}
}
else if ($(children[a]).attr("class") == "rgGroupHeader")
{
break;
}
}
}