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.
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);
Posted by: Jeremiah | March 14, 2008 08:10 AM
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.
Posted by: MArcio | March 18, 2008 09:35 AM
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
Posted by: MArcio | March 18, 2008 10:12 AM
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
Posted by: MArcio | March 18, 2008 12:31 PM
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.
Posted by: KLadofoRA | April 5, 2008 03:26 AM
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/
Posted by: romain | May 15, 2008 11:47 AM
useful post.thanks for ur sharing!
Posted by: ggfou | May 18, 2008 02:37 AM
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
Posted by: akshay | May 19, 2008 11:08 PM
this blog is the AWESOME!
Posted by: labs | June 6, 2008 08:36 PM
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.
Posted by: Doug Marttila | June 16, 2008 04:01 PM