0 Replies Latest reply on Mar 2, 2009 10:16 AM by shishir4u

    Dynamic grouping in ADG works only once


      I have implemented dynamic grouping in advancedDataGrid . I have extended the AdvancedDataGridRenderer to provide a menu which gives options like Dynamic Grouping etc.

      The problem is that i am able to group the grid dynamically only once.It is because of these lines of code :
      groupingCollection.source = ICollectionView(grid.dataProvider); ---(1)
      grid.dataProvider = groupingCollection;--(2) (This converts the dataGrid's dataProvider to IHierarchicalCollectionView type and hence the second time when i click on another column to group it it gives this error : TypeError: Error #1034: Type Coercion failed: cannot convert mx.collections::HierarchicalCollectionView@272e3d1 to
      The error occurs at this code snippet in MenuHeaderRenderer.as:

      var groupingCollection:GroupingCollection = new GroupingCollection();
      var grouping:Grouping = new Grouping();
      var groupingField:GroupingField = new GroupingField(gridColumn.dataField);
      grouping.fields = new Array();
      groupingCollection.source = ICollectionView(grid.dataProvider); //error
      groupingCollection.grouping = grouping;
      grid.dataProvider = groupingCollection;

      I have attached the complete code for your reference.Any help in this regard would be highly appreciated.