You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by jfb <j....@verizon.net> on 2015/07/22 14:18:38 UTC
Show two rows diferences in Adv Datagrid
Hi All,
Here is a sample of my data:
Key_ID FieldA FieldB FieldC FY_01 FY_02 FY_03
10 A B C 12 14 16
15 A B C 10 12 14
Diff A B C 2 2 2
10 AA BB CC 4 25 35
15 AA BB CC 10 12 14
Diff AA BB CC -6 13 21
10 ABC D E 12 14 16
15 ABC D E 5 6 8
Diff ABC D E 7 8 8
In my array collection I have Key_ID's 10 and 15. How can I construct Key_ID
= Diff?
This Diff row represents the difference between every two rows.
Thanks,
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Show-two-rows-diferences-in-Adv-Datagrid-tp10837.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.
Re: Show two rows diferences in Adv Datagrid
Posted by digill5 <di...@digillax.com>.
you could create the summary row by adding it to the dataprovider.
there is an option to create a summary function.
you could monkey patch or create your own DefaultSummaryCalculator.as to have a diff summaryOperation.
subtract the row like in the sum operation and count the rows like in the avg, so if more that two there is an error.
phil gottfried
digillax systems
> On Aug 3, 2015, at 9:19 AM, jfb <j....@verizon.net> wrote:
>
> Hi Phil,
> Thanks for you reply and help.
> I don't have the DIFF row, I have only the rows for 10 and 15's. I am
> sorting the provider for FieldA, FieldB and FieldC.
> You give me a good idea to start with.
> I see that I can use groupCollection but I see only SUM operation.
> Anybody else with other ideas?
> Best,
>
>
>
>
> --
> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Show-two-rows-diferences-in-Adv-Datagrid-tp10837p10888.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
Re: Show two rows diferences in Adv Datagrid
Posted by jfb <j....@verizon.net>.
Hi Phil,
Thanks for you reply and help.
I don't have the DIFF row, I have only the rows for 10 and 15's. I am
sorting the provider for FieldA, FieldB and FieldC.
You give me a good idea to start with.
I see that I can use groupCollection but I see only SUM operation.
Anybody else with other ideas?
Best,
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Show-two-rows-diferences-in-Adv-Datagrid-tp10837p10888.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.
Re: Show two rows diferences in Adv Datagrid
Posted by Phil Gottfried <ph...@digillax.com>.
I would try something like this, if the data shown is the way the data is stored in the data provider and no server update is needed.
also assumes there will always be a row with 10,15 and diff in the data provider and they are in proper order.
on a datagrid cell edit end event, get the current row info and update the data provider.
public function editCellEnd(e:DataGridEvent):void
{
if(e.reason=="cancelled") {
return;
}
var dsRowIndex:int = e.rowIndex;
var dsFieldName:String = e.dataField;
var dsColumnIndex:Number = e.columnIndex;
var vo:* = griddataArr[dsRowIndex];
var col:DataGridColumn = diffdataGrid.columns[dsColumnIndex];
var newvalue:String = diffdataGrid.itemEditorInstance[col.editorDataField];
if(newvalue=="" || newvalue==null) {
e.preventDefault();
return;
}
var oldvalue=vo[col.editorDataField];
// trace(“editend:" + dsRowIndex + ", " + dsFieldName + ", " + dsColumnIndex);
var row10:Number;
var row15:Number;
var rowDiff:Number;
var sanity:Boolean;
if(oldvalue != newvalue ) {//only update if item changed, could put checks for data validation
griddataArr[dsRowIndex][col.editorDataField]= newvalue;//put the changed value in data provider
if(vo.Key_ID==“10”) {
row10= dsRowIndex;
row15= dsRowIndex+1;
rowDiff= dsRowIndex+2;
}
if(vo.Key_ID==“15”) {
row10= dsRowIndex-1;
row15= dsRowIndex;
rowDiff= dsRowIndex+2;
}
if(vo.Key_ID==“Diff”) {
row10= dsRowIndex-2;
row15= dsRowIndex-1;
rowDiff= dsRowIndex;
}
griddataArr[rowDiff][‘FY_01’]= kinQqlxTicketsdataArr[row10][‘FY_01’]-kinQqlxTicketsdataArr[row15][‘FY_01’];
}
}
Phil Gottfried
Digillax Systems
1207 Oakwood Trail
Southlake, TX 76092
817-488-9271
phil@digillax.com
> On Jul 24, 2015, at 12:01 PM, Deepak MS <me...@gmail.com> wrote:
>
>> FY_01
Re: Show two rows diferences in Adv Datagrid
Posted by Deepak MS <me...@gmail.com>.
You may try grouping collection with grouping field as key_id
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7bec.html
On 22 Jul 2015 17:49, "jfb" <j....@verizon.net> wrote:
> Hi All,
> Here is a sample of my data:
>
> Key_ID FieldA FieldB FieldC FY_01 FY_02 FY_03
> 10 A B C 12 14 16
> 15 A B C 10 12 14
> Diff A B C 2 2 2
> 10 AA BB CC 4 25 35
> 15 AA BB CC 10 12 14
> Diff AA BB CC -6 13 21
> 10 ABC D E 12 14 16
> 15 ABC D E 5 6 8
> Diff ABC D E 7 8 8
>
> In my array collection I have Key_ID's 10 and 15. How can I construct
> Key_ID
> = Diff?
> This Diff row represents the difference between every two rows.
> Thanks,
>
>
>
>
>
> --
> View this message in context:
> http://apache-flex-users.2333346.n4.nabble.com/Show-two-rows-diferences-in-Adv-Datagrid-tp10837.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>
Re: Show two rows diferences in Adv Datagrid
Posted by jfb <j....@verizon.net>.
I am attaching a complete example of my issue.
Thanks for your help!
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Show-two-rows-diferences-in-Adv-Datagrid-tp10837p10919.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.
Re: Show two rows diferences in Adv Datagrid
Posted by jfb <j....@verizon.net>.
Hi,
I was able to create the customSubtractionOperation.as file. Now I have an
issue displaying the summary row.
Sample code:
<grids:dataProvider>
<mx:GroupingCollection2 id="gc" source="{acSample}" >
<mx:Grouping label="DIFF" >
<mx:GroupingField name="FieldA" />
<mx:GroupingField name="FieldB" />
<mx:GroupingField name="FiledC">
<mx:summaries>
<mx:SummaryRow summaryPlacement="group">
<mx:fields>
<mx:SummaryField2 dataField="FY_01"
summaryOperation="customSubtractionOperation" />
<mx:SummaryField2 dataField="FY_02"
summaryOperation="customSubtractionOperation" />
<mx:SummaryField2 dataField="FY_03"
summaryOperation="customSubtractionOperation" />
</mx:fields>
</mx:SummaryRow>
</mx:summaries>
</mx:GroupingField>
</mx:Grouping>
</mx:GroupingCollection2>
</grids:dataProvider>
<grids:groupedColumns>
<columns:ExtendedAdvancedDataGridColumn headerText="FieldA"
dataField="FieldA" textAlign="left" width="150" />
<columns:ExtendedAdvancedDataGridColumn headerText="FieldB"
dataField="FieldB" textAlign="left" width="150" />
<columns:ExtendedAdvancedDataGridColumn headerText="FieldC"
dataField="FieldC" textAlign="left" width="150" />
<columns:ExtendedAdvancedDataGridColumn headerText="{acYears[0]}"
dataField="FY_01" textAlign="left" width="100" />
<columns:ExtendedAdvancedDataGridColumn headerText="{acYears[1]}"
dataField="FY_02" textAlign="left" width="100" />
<columns:ExtendedAdvancedDataGridColumn headerText="{acYears[2]}"
dataField="FY_03" textAlign="left" width="100" />
</grids:groupedColumns>
The issue is the it shows extra rows for each grouping field as:
COLUMN A | COLUMN B | COLUMN C | FY 01 | FY 02 | FY03
--------------------------------------------------------------------------
Field A value
Field B Value
Field C value | -XX
| -XX | -XX
Field A value 1 | Field B Value| Field C Value | XX | XX
| XX
Field A value 2 | Field B Value| Field C Value | XX | XX
| XX
How can I make the display similar as:
GROUP COLUMN | COLUMN A | COLUMN B | COLUMN C | FY 01 | FY 02
| FY03
--------------------------------------------------------------------------
Difference
| -XX | -XX | -XX
Field A value 1 | Field B Value| Field C Value |
XX | XX | XX
Field A value 2 | Field B Value| Field C Value |
XX | XX | XX
Difference
| -XX | -XX | -XX
Field A value 1 | Field B Value| Field C Value |
XX | XX | XX
Field A value 2 | Field B Value| Field C Value |
XX | XX | XX
Thanks,
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Show-two-rows-diferences-in-Adv-Datagrid-tp10837p10918.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.