0 Replies Latest reply on Feb 26, 2012 2:23 PM by hobbes26

    AdvancedDataGrid with custom ISummaryCalculator Sorting and Summary


      Hi, I have a very particular problems. My data arrives in a very large array collection. It is filtered according to the user criteria (all this works).

      The results are presented in an advancedDataGrid. Each grouped data has a field telling how many datapoints are significant.

      I thus created and IsummaryCalculator that computes the average of every column according to this number. I.e. if group A has 5 significant items then the ISummaryCalculator return the average of the 5 top items, item B has 9 significant elements and the ISummaryCalculator returns the average of the top 9 and so on. Here is the problem: the significant elements are always at the top. So, the get the proper results, I need the data to be grouped first and then sorted in descending order according to a given field for each grouped item before the summary can be calculated. I've tried HEADER_RELEASE events, i've tried to sort the flat data from the database, I've tried to sort the arraycollection as it arrives, I've tried to sort the dataprovider after the grouping is done and also after the grouping and summary are done. The results are always mixed up. I have seen how to sort multicolumn and I can do that but in my case, the grouping is by item (string) and the sorting is by number which make a concatenated sortCompareFunction difficult. Anyone can give me pointers into how to achieve this. Thanks.