Hi Folks,
I've come across a problem with the RadGrid where after rebinding, the child columns of an auto-generated hierarchy grid do not update with the new column specifications from the data bind (because the columns are changing in the pivoted data).
Below is the definition of the RadGrid. As you can see the columns are not defined and instead generated automatically on binding (given that they are not known until after having been bound, and does also change depending on the pivot grouping query)
As an example, if the grid is initially bound using pivoted data grouped by year (say 2009, 2010 and 2011 columns - as well as TypeId, ParentTypeId and a row description field) then a rebind occurs where the new pivoted data is grouped by month, the mastertable autogeneratedcolumns will be correct (say Jan09, Feb09... Dec11 etc) however each of the nested view columns will contain the original year grouped columns (2009, 2010, 2011 etc).
I've spent days searching for anyone with a similar problem but can't find anything. Is there anyway to force the nested views to rebind when the grid/mastertableview rebinds? Or is there any way to flush the existing autogenerated nested view columns so they will be regenerated during the rebind?
The problem that this rebinding issue creates is such that if the pivot query is continued to be grouped by year but the period changes (such that say 2009 is no longer returned in the result dataset), the table header will update correctly, however the expanded nested view will not be aligned as it leaves space as if 2009 is still there. In the generated HTML the extra <td> can be seen in the row. This is even more obvious when multiple years are removed. I have 'got around' the first problem by simply iterating over the nested view columns and hiding any child columns that should no longer be shown. However, if the grouping period for the pivot query is changed (to by the month instead of year) as previously stated, the auto-generated nested view columns remain with the original year column definitions and as such NO data is shown in the grid given that the columns no longer have anything to match to when binding.
Please let me know if you need any additional information.
Cheers,
Andrew
I've come across a problem with the RadGrid where after rebinding, the child columns of an auto-generated hierarchy grid do not update with the new column specifications from the data bind (because the columns are changing in the pivoted data).
Below is the definition of the RadGrid. As you can see the columns are not defined and instead generated automatically on binding (given that they are not known until after having been bound, and does also change depending on the pivot grouping query)
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
DataSourceID
=
"ObjectDataSource1"
OnColumnCreated
=
"RadGrid1_ColumnCreated"
OnItemCreated
=
"RadGrid1_ItemCreated"
OnItemDataBound
=
"RadGrid1_ItemDataBound"
>
<
MasterTableView
HierarchyDefaultExpanded
=
"false"
HierarchyLoadMode
=
"Client"
AllowSorting
=
"false"
DataKeyNames
=
"TypeId, ParentTypeId"
Width
=
"100%"
>
<SelfHierarchySettings
ParentKeyName
=
"ParentTypeId"
KeyName
=
"TypeId"
/>
</
MasterTableView
>
<
ClientSettings
AllowExpandCollapse
=
"true"
/>
</
telerik:RadGrid
>
As an example, if the grid is initially bound using pivoted data grouped by year (say 2009, 2010 and 2011 columns - as well as TypeId, ParentTypeId and a row description field) then a rebind occurs where the new pivoted data is grouped by month, the mastertable autogeneratedcolumns will be correct (say Jan09, Feb09... Dec11 etc) however each of the nested view columns will contain the original year grouped columns (2009, 2010, 2011 etc).
I've spent days searching for anyone with a similar problem but can't find anything. Is there anyway to force the nested views to rebind when the grid/mastertableview rebinds? Or is there any way to flush the existing autogenerated nested view columns so they will be regenerated during the rebind?
The problem that this rebinding issue creates is such that if the pivot query is continued to be grouped by year but the period changes (such that say 2009 is no longer returned in the result dataset), the table header will update correctly, however the expanded nested view will not be aligned as it leaves space as if 2009 is still there. In the generated HTML the extra <td> can be seen in the row. This is even more obvious when multiple years are removed. I have 'got around' the first problem by simply iterating over the nested view columns and hiding any child columns that should no longer be shown. However, if the grouping period for the pivot query is changed (to by the month instead of year) as previously stated, the auto-generated nested view columns remain with the original year column definitions and as such NO data is shown in the grid given that the columns no longer have anything to match to when binding.
Please let me know if you need any additional information.
Cheers,
Andrew