I have some issues with the WebHierarchicalDataGrid:
1) I'm having a NullReferenceException when i try to group by a column that has null values. How can i resolve this? Is there a way to set default values for the null elements?
2) I'm trying to hide a column when the grid is grouped by it but when i sort the column clicking the button at the group area the column is shown again. Can i control the javascript event of that kind of sorting? (I already control the event of sorting by clicking at the column header)
Thanks.
Hi,
I would think that should work. I have actually done it with code on the server. Could you try this?
protected void WebHierarchicalDataGrid1_GroupedColumnsChanged(object sender, GroupedColumnsChangedEventArgs e)
{
if (e.Action == GroupByChangeAction.Group)
foreach (GroupedColumn col in e.GroupedColumns)
e.Band.Columns[col.ColumnKey].Hidden = true;
if (e.Action == GroupByChangeAction.Ungroup)
e.Band.Columns[col.ColumnKey].Hidden = false;
}
protected void WebHierarchicalDataGrid1_RowIslandDataBound(object sender, RowIslandEventArgs e)
for (int x = 0; x < e.RowIsland.Columns.Count; ++x)
if (x < e.RowIsland.Band.Columns.Count)
e.RowIsland.Columns[x].Hidden = e.RowIsland.Band.Columns[x].Hidden;
-Dave
Thanks for your answer AgentD5.
Here is the code i'm using to hide the column:
<script type="text/javascript">
function changeGroup(e, f) {
var grid = $find("MyGrid");
var parentGrid = grid.get_gridView();
parentGrid.get_columns().get_columnFromKey(f.get_effectedColumn().get_columnKey()).set_hidden(hidden);
</script>
I call this function on the GroupedColumnsChanging client method.
Hi fjVazquez,
I have managed to reproduce your first issue I believe. It happens on a postback after the grouping by the column with the null values happens. I have submitted it internally as bug 81188. If you contact Developer Support, you can have your case attached to this bug and be notified when a SR with the fix has been released.
As for your second issue. How are you trying to hide the columns? You will probably need to hide it on the band, but then copy the Hidden value from the band column to the grid level when the row island is created.
regards,
David Young