AdvancedDatagrid with a summary row

Hello,
I have an AdvancedDatagrid with two grouping fields in a
summary row.
Everything works fine when there is no labelFunction
associated with it.
But as soon as I specify a labelFunction, the summary row
fields are empty. I need a labelFunction to format dates and
numbers.
How to write a proper labelFunction for an AdvancedDatagrid
with a summary row ?
Regards,
Karl.

Okay, I figured it out.
Now, I have two label functions set at the
AdvancedDataGridColumn level for the summary row fields and one
labelFunction set at the AdvancedDataGrid level for all the other
fields.
<mx:AdvancedDataGridColumn id="amountTotal"
dataField="sumAmount" labelFunction="sumAmountLabelFunction" />
<mx:AdvancedDataGridColumn id="collectedTotal"
dataField="sumCollected" labelFunction="sumCollectedLabelFunction"
/>
In order to avoid a null pointer exception on the sumAmount
and sumCollected fields in the label function, I use the
hasOwnProperty() method to check before access. Otherwise, this
exception will happen while expanding the tree.
private function sumAmountLabelFunction(item:Object,
column:AdvancedDataGridColumn):String
if(item.hasOwnProperty("sumAmount"))
return this.numberFormatter.format(item.sumAmount);
return "";
private function sumCollectedLabelFunction(item:Object,
column:AdvancedDataGridColumn):String
if(item.hasOwnProperty("sumCollected"))
return this.numberFormatter.format(item.sumCollected);
return "";

Similar Messages

  • Advanced Datagrid - Summary Row without groupping

    I need to make a datagrid with a summary row on top of it. It
    works fine with the gropping tag inside of groupping collection.
    But i don't need groups - i need only summaries.
    When I white following code inside of Advanced - flex crashes
    and tell something like "cannot null blablala".
    quote:
    <mx:GroupingCollection id="smallMetricsDataProvider"
    source="{bigMetrics}">
    <mx:summaries>
    <mx:SummaryRow summaryPlacement="first">
    <mx:SummaryField dataField="@type" operation="COUNT"
    />
    <mx:SummaryField dataField="@budget"
    summaryFunction="MetricsUtils.varianceTotalCount" />
    <mx:SummaryField dataField="@raw"
    summaryFunction="MetricsUtils.varianceTotalCount" />
    </mx:SummaryRow>
    </mx:summaries>
    </mx:GroupingCollection>
    What can you advice 4 me?
    Thanks, Roman.

    Fine, I found a way how to do it, using renderprovider 4
    folder items with a null height =))).
    It's a hack, the bad hack, i hope it wold be improved...
    So, i have another problem - i want to get this summary
    values. How?
    Thanks, Roman.

  • Style AdvancedDataGrid Summary Rows

    I have an AdvancedDataGrid with summary rows. Everything works fine, but the user wants the summary rows bolded, so the totals stand out even when the categories are expanded. There don't seem to be any style properties, itemRenderers, or labelFunctions associated with any level of a GroupingCollection. How can I do this?
    Thanks.
    -John

    I figured it out, so here it is for posterity:
    I had to use the AdvancedDataGridColumn's styleFunction, and test the row object for a "GroupLabel" property. If it exists, bold the row, like below:
              protected function boldSummaryRows(row:Object, column:AdvancedDataGridColumn):Object {
                    var styleObject:Object = new Object;
                    if(row.hasOwnProperty('GroupLabel'))
                        styleObject.fontWeight = 'bold';
                    return styleObject;

  • How can i create a grid with summary row

    Hello Professionals,
    I'm wondering how could i create a grid like the grid below, i want to create a grid with summary row,
    i have tried to create it using collapsing but it didn't work as required.
    Any suggestions?, i want to know just the starting point so i can make deep investigations.
    Thanks in Advance,

    Hi Karem,
    this can be achieved by just assigning a datatable containing the data plus some formatting of grid. Meaning there is no feature for that.
    The datatable can be filled manually or by sql query. Then you have to attach some events for updating the values ( validate after for gid item ).
    A small example for a sql query showing last month quotations and orders with summary :
    select 1 as Sort,cast(DocNum as varchar) as DocNum,DocTotal,convert(varchar, DocDate,104) from OQUT where DocDate between  DATEADD(month, -1, GETDATE()) AND GETDATE()
    UNION ALL
    Select 2 as Sort,'Summary ( Quotation ) : ',sum(DocTotal), convert(varchar,  DATEADD(month, -1, GETDATE()),104)+' - '+convert(varchar,   GETDATE(),104) from OQUT where DocDate between  DATEADD(month, -1, GETDATE()) AND GETDATE()
    UNION ALL
    select 3 as Sort,cast(DocNum as varchar) as DocNum,DocTotal,convert(varchar, DocDate,104) from ORDR where DocDate between  DATEADD(month, -1, GETDATE()) AND GETDATE()
    UNION ALL
    Select 4 as Sort,'Summary ( Order ) : ',sum(DocTotal), convert(varchar,  DATEADD(month, -1, GETDATE()),104)+' - '+convert(varchar,   GETDATE(),104) from ORDR where DocDate between  DATEADD(month, -1, GETDATE()) AND GETDATE()
    ORDER by Sort
    regards,
    Maik

  • Customizing summary row AdvancedDatagrid

    i want to customise the look and feel of the summaryRow of the AdvancedDatagrid by including borders to the top and the bottom.I tried overriding createChildren() and adding HRule  as the first and last child of the summaryRenderer.The HRule is  getting added but it is not getting displayed.Am i doing somthing wrong.If so how can i customize the look and feel .Please suggest

    You can just use Renderer providers to customize your SummaryRow just like you use Renderer Providers for your columns.Specify the label name of the summary row that you want to customize in the renderer provider.

  • Summary rows

    I am new to Flex. I wasn't quite sure how to code summary
    rows in actionscript. Could some take a look at my codes and help
    me figure out why it doesn't work? I really appreciate it.
    I need to display a fixed data in group row. That is, I don't
    need to calculate the result to be displayed in group row.

    "irislpc" <[email protected]> wrote in
    message
    news:ghpdmn$s2k$[email protected]..
    > If I am not displaying the hierarchical data in
    AdvancedDataGrid by using
    > group
    > collection, can I still use summary rows? I populate the
    advanced data
    > grid
    > with external xml file. The xml is structured
    hierarchically so that I
    > don't
    > need to group the data. The problem is I have data that
    need to be
    > displayed in
    > group row. Can I use summaries function to do that?
    > Here is the sample application
    >
    http://www.irislin.net/itemRenderer/reliability.html
    http://livedocs.adobe.com/flex/3/html/help.html?content=advdatagrid_08.html
    "Note: Summary data is not supported for hierarchical data
    represented by
    the HierarchicalData class. You can only create summary data
    for data
    represented by the GroupingCollection class."
    I couldn't get at your app, since I'm not going to upgrade to
    Flash Player
    10 just to help you (I think that change is far more
    difficult to undo than
    to do), but you might find that you can make a
    GroupingCollection from your
    XML just by casting it.

  • String type data in Summary Row

    Hi,
    Can any one hlep out on this..
    I am working as a flex developer in one organization.I have a special scenario like,
    I want to display comments in Summary Row,
    But as per my knowledge Summary Rows can hold only numeric data.is it possible to display String type data in Summary row.
    If possible , please provide that piece of code.

    "nikos101" <[email protected]> wrote in
    message
    news:gq8693$9a$[email protected]..
    >I am using the following in a summary row in a
    AdvancedDataGrid. How would
    >I
    > modify it to also display a piechart with its data?
    >
    > package
    > {
    > import
    mx.controls.advancedDataGridClasses.AdvancedDataGridItemRenderer;
    > import mx.controls.listClasses.BaseListData;
    >
    > public class ItemTotalGBP_Renderer extends
    AdvancedDataGridItemRenderer
    > {
    > public function ItemTotalGBP_Renderer()
    > {
    > super();
    > }
    >
    > override public function set data(value:Object):void
    > {
    > super.data = value;
    > listData.label = " " + data["totalTransfers"]
    > +
    > " Transfers " + data["totalGBP_Eq"].toFixed(2) + " GBP
    equivalent";
    > }
    >
    > }
    > }
    The pie chart example here seems really close to what you
    want:
    http://www.adobe.com/livedocs/flex/3/html/help.html?content=advdatagrid_10.html

  • Displaying Document Name With The Summary in a Single Column Using Document Library View.

    Hi All,
    I have a question that relates to SharePoint Document Library Views. I want to view the Documents name with the summary in a single column. Below image shows an example of it. I need this within a SharePoint Document Library. Also I want the height of the
    row to be increased more than the default height. I cannot figure it out how to do that? Could you someone help me to do this. I have inserted the Document Library as an App Part to the page. 
    So could you someone help me to solve this matter?
    Thanks and regards,
    Chiranthaka

    HI Chiranthaka,
    You can create DataView webpart using SPD and then modify the display template according to your need.
    http://deannaschneider.wordpress.com/2012/07/10/item-counts-dvwp-sp2010/
    Hope this will help to solve your problem.
    Best Regards,
    Brij K

  • Using Previous function in summary rows?

    Hi,
    I have a requirment, where I have to use the value got in previous column in the summary row.
    The scenario is as follows.
    There are Product, Quantity on Hand , Order Type and Date column. I am using cross tab, As I have to use the details of columns for each date.
    So date will be spreaded across table as there are more dates.
    In summary column, I would like to do a calcuation for each date. And I should use the calculated amount on one date in the next date and the calcuation continues.
    I am trying to use previous function, but its showing computation error.
    I am attaching a excel sheet with a sample example for easy understanding.
    The calculation which I used in summary row is avialble in formula section, when we select the column.
    Thanks in Advance.
    Regards
    Gowtham

    Hi BOCP,
    Yes, I am trying to use this function in Summary after Break.
    Sorry, I missed out attachment. And I didn't find a way to attach it.
    Suresh,
    I didn't find last() function in WebI Editor. I am using BO XI R2.
    Thanks a lot.
    Regards,
    Gowtham Sen.

  • Tabular form calculated summary row

    Hopefully this may be a quick question with either a yes or a no
    I have a tabular form with columns
    Project Name , Wk1 , Wk2 , Wk3 etc ,
    basically so PM's can track the hours against a project
    I have used the sum checkboxes to create a summary row
    but they also want a row that calculates how many hours remaining for each week under the week no cols , obviously subtracted ffrom the hours budget for each week assigned to the project and person
    I've done the summary and calculation in a view but this isn't acceptable as a UNION query in a tabular form
    I've also tried another region under the Tabular form but as the project name is a variable length its not easy keeping the Wk cols aligned
    thanks in advance
    Chris

    Hi Gus/Paul,
    I had the same requirements as you, resulting from the fact that newly added rows may not be visible to the user until he/she has scrolled down sufficiently, but, by lowering my standards (something I excel at :D ), I was able to find an acceptable compromise.
    As you probably noticed yourselves, when you "edit" the ADD button, you can see that a call is made to the addRow() javascript function. I therefore took a look at the javascript code - foolish really as I am an oracle DBA from the Jurassic period. Needless to say it scared the pants off me... So, fuelled by cowardice, I snatched at an inferior-but-dead-easy-to-implement alternative solution whereby the page is automatically "scrolled" to the bottom of the form when the "ADD" button is clicked.
    Should this "cop out" work for you, you can implement it in the following way:
    1. Create a new HTML region immediately after the tabular form, containing the following source: <font color="blue">&lt;a name="bottom_of_page"&gt;&lt;/a&gt;</font>
    2. Amend the action when the "ADD" button is clicked to scroll down to the new region by doing the following:
    - edit "ADD" button
    - Go to "Action when button Clicked" section
    - Amend "URL Target" from
    <font color="blue">Javascript:addRow();</font>
    <br>to
    <font color="blue">Javascript:addRow();window.location='#bottom_of_page'</font>
    <br>
    <br>Regards,
    Amr.

  • Adding a dynamic summary row for a spark data grid

    i'm looking for a solution for a spark data grid.
    by clicking on a row it will become larger and will show under the original row a some kind of a summary text with no realtion to columns.
    is there a summary row option for a spark datagrid that can shown by clicking on the row?

    Why would you need to make this part of the DataGrid? Just create some kind of view and bind it's data to the selectedItem of the DataGrid.
    *edit*
    Ohhhh, I see that you want it to display under the item. I believe you can do what you need in the skin, but I haven't had a chance to use the spark DataGrid yet so I can't say for sure. I know it has a feature to skin the selection, so I'm sure you can use that to do what you need.

  • Summary row in JTable

    I have created a JTable with some information. I want to have the last row of the table as a summary row so I want it to stand out. How would I go about putting the text in the last row of the table in bold font?
    Thanks for help!

    I looked at this example, but I thought that while the structure of the tutorial is good, the code might not be so great. Take for example the number renderer class, I won't repeat it here (might violate copyright) but the setValue method gets a number instance each time it is invoked to render a cell. My understanding is that this is inefficient, as getting an instance is a fairly involved procedure (it involves looking up locale information for instance). Also the code makes heap allocations which could potentially overwhelm the garbage collector (from what I've read).
    I'm learning java, and I used the example to make a decimal renderer. The main purpose of this is to show the number for the default locale and the specified number of decimal places:
    import java.text.NumberFormat;
    import java.text.DecimalFormat;
    import javax.swing.table.DefaultTableCellRenderer;
    public class DecimalRenderer extends DefaultTableCellRenderer {
        int precision = 0;   //my addition
        Number numberValue;   //moved from setValue()
        NumberFormat nf;   //moved from setValue()
        public DecimalRenderer(int p_precision) {
            super();   //same as example
            setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);  //same as example
            precision = p_precision;  //my addition
            nf = NumberFormat.getNumberInstance();  // moved from setValue
            nf.setMinimumFractionDigits(p_precision);  // my addition
            nf.setMaximumFractionDigits(p_precision);  // my addition
        public void setValue(Object value) {
          if ((value != null) && (value instanceof Number)) {
            numberValue = (Number) value;   // re-use the class member, not a local member
            value = nf.format(numberValue.doubleValue()); // same as example
          super.setValue(value);
      } By re-using the number instance and making the variables class level fields as opposed to local members of the setValue function, I expect to avoid the problems I mentioned above.
    Have I understood the situation correctly? I guess that experienced people would be aware of this, but I get annoyed by the examples I see as they typically give 'expedient' examples which seldom represent 'best practice'. Often, I can see that something probably isn't best practice, but I don't know what the best practice is.

  • Summary row in tableview (including sorting and BYPAGE navigation)

    Hello everybody,
    I already found a few topics dealing with this problem but I wasn't able to find a real solution for this.
    So far I'm pretty familiar with table iterators but I have no idea how to handle the summary row to be the last line in a table, even if sorting and navigation by page is allowed in the tableview.
    I think you definitely have to add this summary row in your internal table, since you can not add a virtual row in your tableview. And you can custom render this row or respectively each cell for instance with a different color but how to force this row always to appear as the last row in every tableview page (navigation=BYPAGE).
    Does anyone have a solution for that?
    Thanx
    Oliver

    Ok, here is what I came up with (hoping I got your problem right):
    In your tableview you are displaying <b>x</b> rows, and after these rows you want your sum row to be displayed.
    I have done quite some things with iterators, but why not do without one here
    Altering the internal table can do as well:
    Try to insert a new row after every <b>x</b> rows into your internal table which holds the needed sum values, and then change your tableview to display <b>x+1</b> rows.
    In you case you need to do some operations with your internal table (to avoid the sum rows messing up the results) you should somehow "mark" these sum rows so you can distinguish them later on.
    Hope this is helpful for your problem.
    Max

  • JTable Header/summary  Row

    Hi
    I have a jtable and I want to add a summary row right under the header. I added a row and I specified in the sorting class to start from 1 instead of 0, which made my summary not sortable. but, when I scroll down, the summary row disappears.
    How can I make it not disappear? the same problem with printing. I'm using the table.print method and it prints only in the first page, while I want to print on every page.
    I think I should add it as part of the header? I have no idea how to do that.
    any ideas or help?
    Thanks,
    Benbak
    Message was edited by:
    Benbak

    I think you will find something here: http://www.physci.org/codes/tame/

  • Vertically scrolling an AdvancedDataGrid with custom ItemRenderers results in corruption

    I've logged a jira item about this ...
    http://bugs.adobe.com/jira/browse/FLEXDMV-2667
    It's probably a good idea to throw it open to the forum as well to see if anyone has encountered this before.
    In short, I have an AdvancedDataGrid with custom ItemRenderers on each of the columns that are responsible for rendering the cell data. If the ADG is resized so that it's not all visible, and the scrollbar is scrolled all the way up and all the way down a couple of times, and the ADG is then resized again so that all the rows are visible, there's something very wrong with the result. Basically it looks as though extra rows are being drawn behind the existing ones, all on top of one another, resulting in a corrupted display.
    I've actually gotten it to reproduce itself every time, if you check out the jira item above for executable code and follow the instructions you should see it, and there's a screenshot of the result as well.
    As I detail in the jira commentary, it's definately something to do with the renderers. As the scroll bar is moved up and down extra renderers are consantly being created, and old ones don't seem to be GC'd at any point, and furthermore seem to be drawn onscreen even when they're not being used to explicitly draw the cells of the ADG. If this -is- the case then there's a memory leak here as well.

    Throwing the code inline to make it easier to try out ...
    ADGItemRendererIssue.mxml:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
                   creationPolicy="all"
                   creationComplete="init()">
        <s:layout>
            <s:BasicLayout/>
        </s:layout>
        <fx:Script>
            <![CDATA[
                import ADGIssue.*;
                import mx.collections.*;
                import mx.controls.*;
                import mx.controls.advancedDataGridClasses.*;
                import mx.core.IFactory;
                import mx.events.AdvancedDataGridEvent;
                import mx.events.ListEvent;
                import spark.components.supportClasses.ItemRenderer;
                [Bindable]
                public var expenses:ArrayCollection = new ArrayCollection([
                    {Expense:"Taxes", Amount:100, Cost:80, Discount:20},
                    {Expense:"Rent", Amount:200, Cost:90, Discount:21},
                    {Expense:"Bills", Amount:300, Cost:100, Discount:22},
                    {Expense:"Books", Amount:400, Cost:110, Discount:23},
                    {Expense:"Food", Amount:500, Cost:120, Discount:24},
                    {Expense:"Goldfish", Amount:600, Cost:130, Discount:25}
                public var cache:Dictionary = new Dictionary(true);
                protected function init():void
                    var grp:AdvancedDataGridColumnGroup = new AdvancedDataGridColumnGroup();
                    grp.headerText = "Expenses";
                    grp.dataField = "Expense";
                    grid.groupedColumns = new Array();
                    grid.groupedColumns.push(grp);
                    grp = new AdvancedDataGridColumnGroup();
                    grp.headerText = "Finances";
                    grp.children = new Array();
                    var col:AdvancedDataGridColumn = new AdvancedDataGridColumn();
                    col.headerText = "Amount";
                    col.dataField = "Amount";
                    col.itemRenderer = new ADGIssueItemRendererFactory("Amount");
                    grp.children.push(col);
                    col = new AdvancedDataGridColumn();
                    col.headerText = "Cost";
                    col.dataField = "Cost";
                    col.itemRenderer = new ADGIssueItemRendererFactory("Cost");
                    grp.children.push(col);
                    col = new AdvancedDataGridColumn();
                    col.headerText = "Discount";
                    col.dataField = "Discount";
                    col.itemRenderer = new ADGIssueItemRendererFactory("Discount");
                    grp.children.push(col);
                    grid.groupedColumns.push(grp);
                    grid.dataProvider = expenses;
            ]]>
        </fx:Script>
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <mx:VDividedBox x="35" y="29" width="80%" height="600">
            <mx:AdvancedDataGrid  height="400" id="grid" designViewDataType="flat"  width="100%"/>
            <s:TextArea text="just some text to take up a wee bit of space" width="100%"/>
        </mx:VDividedBox>
    </s:Application>
    ADGIssueItemRendererFactory.as (in package ADGIssue)
    package ADGIssue
        import flash.utils.Dictionary;
        import mx.core.IFactory;
        public class ADGIssueItemRendererFactory implements IFactory
            private var _label:String;
            public function ADGIssueItemRendererFactory(label:String)
                trace("Creating Factory for: "+label);
                _label = label;
            public function newInstance():*
                return new ADGIssueItemRenderer(_label);
    ADGIssueItemRenderer.as (also in package ADGIssue)
    package ADGIssue
        import components.*;
        import mx.controls.Label;
        import mx.controls.listClasses.*;
        import mx.core.*;
        import mx.logging.ILogger;
        import mx.logging.Log;
        import mx.logging.LogEventLevel;       
        public class ADGIssueItemRenderer extends Label implements IDataRenderer
            private var _label:String;
            private var countvalue = 0;
            private static var count:int = 0;
            public function ADGIssueItemRenderer(label:String)
                trace("Creating Renderer for: "+label+" with count: "+count);
                _label = label;
                this.countvalue = count;
                count ++;
            override public function set data(rowData:Object):void
                if (rowData)
                    this.text = countvalue+":"+rowData[_label];
                    trace("RENDERING: "+this.text);
    run the MXML and follow the instructions in the JIRA item ...
    1. resize the ADG so that not all of the ADG is visible vertically, and the verticle scrollbar is shown. In the example attached the ADG is in a split panel, so the split bar can be dragged up to conceal some of the rows and display the scrollbar.
    2.  drag the scroll thumb all the way to the top of the scrollbar, and all the way to the bottom and back to the top several times.
    3.  Resize the ADG again so that all the rows are visible.
    and the corruption should be clear to see. Here's a screenshot of what it looks like:
    Anyone ever seen anything similar ? And if so, any workarounds or fixes ?

Maybe you are looking for

  • Power adapters and worldwide compatibil​ity - a lesson

    The standard fare today in power adapters is such that the brick itself is compatible around the world. Indeed, the input power on a Lenovo AC adapter is rated from 100-240V and 50 or 60Hz - capable of operating on any power standard. The only catch

  • Lost Adobe tab in Word 2007

    Hi, I had a Word 2007 crash, and when I reopened Word the Adobe tab (for converting to PDF) tab had disappeared When I go to Word options > Add-ins > COM add-ins I can see a check box with Acrobat PDFMaker Office COM add-in.(exact names may not be ac

  • Difference of the results more than 1000

    I have to write a procedure where if the results of the following result set varies by more than 1000 than it should sent out a paramter YES COUNT(1)     TABLE_NM 42986     A_TBL 539     B_TBL 42986     C_TBL 42986     AD_TBL so if the difference bet

  • How to create SVGZ-Files in Java?

    Hi, I'am able to create normal SVG File with the Java-File API, but I'm not able to create SVGZ Files. I've herad that it could work with the java.util.zip library but the example creates no valid svgz-file. Has someone an idea? Thanks! //--> path of

  • Backup of database online

    i am working oracle 8i standard vesion. i want to maintain dual servers for database. if one database goes down the other maintaing the backup of database should start immediately. all the users should automatically conect to this database. this is p