« Custom ArrayCollections, Adding New Items to DataGrid | Main | Flex 3.x Versioning and Portals »

Flex 3 DataGrid Footers

I took a few minutes to prove that there is another way to add Footers to DataGrid in Flex 3. The old blog post showed how to add footers to the border. In Flex 3 we added more hooks so you can add other "content areas" to the DataGrid.

I'm short on time so the example isn't fully fleshed out. It could definitely use some optimization as to when and how often it refreshes. It probably needs masking if horizontal scrollbars are on, but at least it should show up in the right place relative to the horizontal scroll bar. There's probably bugs as well, so the usual caveats apply, but it should get you started in the right direction. Also, I did not try this with AdvancedDataGrid. It is actually developed by an entirely different team.

Download Source
Run Demo

Comments

I've implemented the code you provided to show some total rows on my data grids. I ran into a couple of issues that were overcome by a couple small changes to the code as follows:

listContent.setActualSize(listContent.width, listContent.height - (footerHeight+15));
footer.setActualSize(listContent.width, footerHeight);
footer.move(listContent.x, listContent.y + listContent.heightExcludingOffsets + 15);

This component is fantastic, Very Good

But

if i use delete

paddingTop="0" paddingBottom="0" verticalAlign="middle"

and include

width="100%" height="100%"
in

The Footer of datagrid not display correct

Please test your Datagrid with 138 records


------

if i use this

And update in file

FooterDataGrid.as

in line 19

protected var footerHeight:int = 22;

to

protected var footerHeight:int = 24;


Functional is correct !


----------------

How should I proceed?

---------------------------
Alex responds:

This code is just a prototype and is unsupported. If you have it working, great.

If i resize collum datagrid and in sequence i use slider to filter datagrid the error ocurred

-------------

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at DataGridFooter/updateDisplayList()[C:\inetpub\wwwroot\webserver\rarus_admin_flex_2\src\DataGridFooter.as:103]
at mx.core::UIComponent/validateDisplayList()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:6214]
at mx.managers::LayoutManager/validateDisplayList()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:602]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:675]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/callLaterDispatcher2()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8460]
at mx.core::UIComponent/callLaterDispatcher()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8403]

-------------

Please Help me, how to resolve this ?


----------------------
Alex responds:

in DataGridFooter.as in updateDisplayList, check to see if col is null and break out of the while loop

if i use itemRenderer error ocurred

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at DataGridFooter/updateDisplayList

-------------












---------------

----------------------------
Alex responds:

Your custon renderer must implement IDropInListItemRenderer

thanks for that just was asking can’t we using any thing and replacing it on this code
footer.setActualSize(listContent.width, footerHeight);
?

thanks

---------------------------
Alex responds:

Not sure I understand the question. I guess you can make the footer some other size if you want to.

Hi Alex,
You talked about a version for AdvancedDataGrid developed by an other team. Do you have a link for showing that ? thanks

-----------------
Alex responds:

ADG has SummaryRows. It is developed by another team. I don't know if they've done footer support or not. Try Sameer's blog: http://techrays.wordpress.com/

useful post.thanks for ur sharing!

how to enhance debugging in flex :(

---------------
Alex responds:

Debugging works fine for me. If you want specific features that other debuggers have, please file bugs/enhancement requests at bugs.adobe.com/jira

this blog is the AWESOME!

Hi, I added some functionality to these footers - horizontal scrolling, column resizing, and locked columns. I also implemented for the Advanced Data Grid. Post here. Thanks for the great post and great starting point.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)