I am looking at your sample on how to Expand/Collapse grouped grid client-side on external control click and I get this to work fine to expand or contract all the groups.
function toggleGroup(e) {
var tableView=$find('<%=RadGrid1.ClientID %>').get_masterTableView();
var rows=tableView.get_element().rows;
for(var i=0,len=tableView.get_element().rows.length;i<len;i++) {
var button=tableView._getGroupExpandButton(rows[i]);
if(button) {
var groupLevel=button.id.split("__")[2];
if(groupLevel==0) {
tableView._toggleGroupsExpand(button,e);
}
}
}
}
However what I need is to only expand certain groups that the button pertains to. Is there a way to iterate through the group headers and only expand certain ones. I am stumped at finding a way to access the group header text in Javascript.
I am setting the group header text in the ItemDataBound like this
If TypeOf e.Item Is GridGroupHeaderItem Then
Dim GroupHeader As GridGroupHeaderItem = DirectCast(e.Item, GridGroupHeaderItem)
Dim item As GridGroupHeaderItem = DirectCast(e.Item, GridGroupHeaderItem)
Dim groupDataRow As DataRowView = DirectCast(e.Item.DataItem, DataRowView)
item.DataCell.Text = groupDataRow.Row.ItemArray(0).ToString()
End If
function toggleGroup(e) {
var tableView=$find('<%=RadGrid1.ClientID %>').get_masterTableView();
var rows=tableView.get_element().rows;
for(var i=0,len=tableView.get_element().rows.length;i<len;i++) {
var button=tableView._getGroupExpandButton(rows[i]);
if(button) {
var groupLevel=button.id.split("__")[2];
if(groupLevel==0) {
tableView._toggleGroupsExpand(button,e);
}
}
}
}
However what I need is to only expand certain groups that the button pertains to. Is there a way to iterate through the group headers and only expand certain ones. I am stumped at finding a way to access the group header text in Javascript.
I am setting the group header text in the ItemDataBound like this
If TypeOf e.Item Is GridGroupHeaderItem Then
Dim GroupHeader As GridGroupHeaderItem = DirectCast(e.Item, GridGroupHeaderItem)
Dim item As GridGroupHeaderItem = DirectCast(e.Item, GridGroupHeaderItem)
Dim groupDataRow As DataRowView = DirectCast(e.Item.DataItem, DataRowView)
item.DataCell.Text = groupDataRow.Row.ItemArray(0).ToString()
End If