I believe I found the secret sauce with the help of you guys, thanks!
Here is what I did… 1. In my renderer set data function I ended the function with this.validateNow(); This helped, but was not a 100% fix. 2. Next, after my DataGrid is finished resizing, I call DataGrid.invalidateList(); This caused the renderers to fire. Again, not a 100% fix. With the combination of these two the resizing was working perfectly, but the initial render was still all dorked up. The initial render would have the first row at what seemed to be a random height. If I kept clicking my button to display the grid, all rows would be perfect except the first. Each time I displayed the grid the first row would be a different height. 3. The final ingredient to the sauce is that instead of setting my data into my ArrayCollection 1 at a time, I set them first in a temporary ArrayCollection and when I’m done setting my data, I set my ArrayCollection used in the DataGrid dataProvider = my temporary ArrayCollection. This is better code anyway… Much more efficient. But, I’m not sure what I would do if I was in other parts of our app when that is not possible. I am still completely stumped as to why I need to do this and my other fixes didn’t work (ie: simply invalidateSize() or invalidateDisplayList()) Thanks for all that helped with suggestions. Dale From: [email protected] [mailto:[email protected]] On Behalf Of Sydney R. Bennett Sent: Friday, January 08, 2010 2:16 PM To: [email protected] Subject: Re: [AFFUG Discuss] Datagrid itemRenderer help please Maybe just as a test, try to purposefully hardcode the height of the VBox to some large value in commitProperties() and then invalidateProperties() in the setter for data? You might have to invalidateDisplayList() as well. I've run into this rendering problem a lot myself and have yet to find a good solution that consistently works. Let us know if you find a solution. Sydney _____ From: Dale Bronk <[email protected]> To: [email protected] Sent: Fri, January 8, 2010 2:01:59 PM Subject: RE: [AFFUG Discuss] Datagrid itemRenderer help please One other piece of information… When I scroll the DataGrid, it will correctly reset the size for the Renderer when the row leaves the screen and scroll back in view. From: Dale Bronk [mailto:[email protected]] Sent: Friday, January 08, 2010 1:59 PM To: [email protected] Subject: RE: [AFFUG Discuss] Datagrid itemRenderer help please Yep, forgot to mention that. From: [email protected] [mailto:[email protected]] On Behalf Of Justin Nichols Sent: Friday, January 08, 2010 1:46 PM To: [email protected] Subject: Re: [AFFUG Discuss] Datagrid itemRenderer help please Do you have variableRowHeight="true" on the DataGrid? Thanks, Justin Nichols On Jan 8, 2010, at 1:41 PM, Dale Bronk wrote: I have a pretty simple datagrid. It has a single column in which we have an itemRenderer that that will display the column in different ways depending on the type of object to display. Pretty simple and working fine except for resizing. One of the renderer states is a simple VBox with the contents as follows: <mx:FormItem label="Event Section:" id="formitem1" width="100%" labelStyleName="itemLabel"> <mx:Text id="eventSection" width="100%" /> </mx:FormItem> <mx:FormItem label="Form Name:" id="formitem2" width="100%" labelStyleName="itemLabel"> <mx:Text id="formName" width="100%" /> </mx:FormItem> <mx:FormItem label="Field Name:" id="formitem3" width="100%" labelStyleName="itemLabel"> <mx:Text id="fieldName" width="100%" /> </mx:FormItem> <mx:Text id="message" width="100%" /> <mx:Spacer height="3" /> The renderer (VBox) is set to w/h = 100%. We have scroll policies turned off on the VBox and want each VBox to be the size needed to display the data. Our DataGrid UI has a toggle button for small size and large size. In large size everything works fine because there is no wrapping of the Text. But when in small mode a couple of the Text controls will wrap as we want them to, but the VBox does not resize (or the DataGridColumn) and we have text that goes off the bottom of the renderer. I've tried invalidateDisplayList() and invalidateList() on the DataGrid as well as placing invalidateDisplayList() and invalidateSize() in the renderer set data function. Any advice or push in the right direction would be appreciated. Thanks, Dale ------------------------------------------------------------- To unsubscribe from this list, simply email the list with unsubscribe in the subject line For more info, see http://www.affug.com Archive @ http://www.mail-archive.com/discussion%40affug.com/ List hosted by http://www.fusionlink.com ------------------------------------------------------------- ------------------------------------------------------------- To unsubscribe from this list, simply email the list with unsubscribe in the subject line For more info, see http://www.affug.com Archive @ http://www.mail-archive.com/discussion%40affug.com/ List hosted by FusionLink <http://www.fusionlink.com> ------------------------------------------------------------- ------------------------------------------------------------- To unsubscribe from this list, simply email the list with unsubscribe in the subject line For more info, see http://www.affug.com Archive @ http://www.mail-archive.com/discussion%40affug.com/ List hosted by FusionLink <http://www.fusionlink.com> ------------------------------------------------------------- ------------------------------------------------------------- To unsubscribe from this list, simply email the list with unsubscribe in the subject line For more info, see http://www.affug.com Archive @ http://www.mail-archive.com/discussion%40affug.com/ List hosted by http://www.fusionlink.com -------------------------------------------------------------
