Hello everybody!
I'm with a problem in AdvancedDataGrid one and I can not explain it,
but come on!
Please see this image:
http://www.photoshop.com/accounts/175aed244a84416b8a8c9a383349875c/assets/3d1c3f1b7b1e46b3add6a196e89bf641
ADG does my two groupings: one for "reference" (is the address of the
site; second level) and the other by date (first level).
SummaryFunction I use to generate power that last column is the
average of the values.
The problem: When the User choose the time information, the highest
level (data) should provide a sum of the average levels and not below
an average of them (as now).
In the example of the image it shows 9:26 in column B / C, but should
be 18:52, which is the sum of the two averages.
The code to generate this grouping (which is dynamic) is the
following:
----------------------
private function gerarAgrupamento():void {
var myGColl:GroupingCollection2 = new
GroupingCollection2();
var group:Grouping = new Grouping();
var sr:SummaryRow = new SummaryRow();
var sfA:SummaryField = new SummaryField();
var sfB:SummaryField = new SummaryField();
myGColl.source = dgRelatorioVel.dataProvider;
sr.summaryObjectFunction = objFunc;
sfA.dataField = "VM_BC";
sfA.label = "mediaBC";
sfA.summaryFunction = summFunc;
sfB.dataField = "VM_CB";
sfB.label = "mediaCB";
sfB.summaryFunction = summFunc;
sr.fields = [sfA,sfB];
sr.summaryPlacement = "group";
var gfDataGravacao:GroupingField = new GroupingField
();
gfDataGravacao.name = "data_gravacao";
gfDataGravacao.summaries=[sr];
if(!btTodosTrechos.selected) {
var gfReferencia:GroupingField = new
GroupingField();
gfReferencia.name = "referencia";
gfReferencia.summaries=[sr];
group.fields = [gfDataGravacao,gfReferencia];
} else {
group.fields = [gfDataGravacao];
}
myGColl.grouping = group;
myGColl.refresh();
dgRelatorioVel.dataProvider = myGColl;
dgRelatorioVel.validateNow();
}
private function summFunc(cursor:IViewCursor,
dataField:String,
operation:String):Number {
var _auxConta:Number = 0;
var oddConta:String;
var count:int = 0;
var cor:uint;
while(!cursor.afterLast) {
_auxConta += cursor.current[dataField];
cursor.moveNext();
count++;
}
oddConta = (_auxConta/count).toFixed(2);
return parseFloat(oddConta);
}
----------------------
Does anyone have any idea how can I solve this?
Sorry for the length of the post, but it was the way I found to
explain my problem!
Ah And sorry for bad English too.
Hugs and thank you.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---