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 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
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,
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 answers. The code you put worked perfectly.
I added some code for ungrouping because when you ungroup a column it continued hidden.
protected void WebHierarchicalDataGrid1_GroupedColumnsChanging(object sender, GroupedColumnsChangingEventArgs e)
foreach (GroupedColumn col in e.EffectedColumns)
Ok, thanks.
Column Fixing is not supported in the WHDG at this point in time. If you would like to see it so, please submit a feature request.
regards,David Young
I have another error when i try to group by a column with the behavior columnfixing and AutoAdjustCells set to true.
This is a javascript error at the _onHorizontalScrollBarWidthInit function. "Can't obtain the value of the property 'get_element': the object is null or undefined" and another at the _gridViewCreated function. "The object doesn't allows the property or method '_get_bandFromAdr' "
I'm using version 10.3.20103.2120
I've found another issue with the grids. When order a grid by a column (clicking at the column header or by method) the width of the grid columns is not fixed to the width of the grid (i have columns with the width value defined and columns without it). It happens with the explorer 8. In the explorer 9 seems to be fixed.
The only solution i see is to set the width value for all the columns but i have another problem. When i group by a column the grid messes up.