Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 162033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:19:09+00:00 2026-05-11T11:19:09+00:00

I’m trying to create a datagrid which will resize vertically to ensure all the

  • 0

I’m trying to create a datagrid which will resize vertically to ensure all the renderers are displayed in full. Additionally,

  • Renderers are of variable height
  • Renderers can resize themselves

Generally speaking, the flow of events is as follows :

  • One of the item renderers resizes itself (normally in response to a user click etc)
  • It dispatches a bubbling event which the parent datagrid picks up
  • The DataGrid attempts to resize to ensure that all renderers remain visible in full.

I’m currently using this code within the datagrid to calculate the height:

height = measureHeightOfItems(0, dataProvider.length ) + headerHeight; 

This appears to get an incorrect height. I’ve tried a number of variations including callLater ( to ensure the resize has completed so measure can work correctly), and overriding meausre() and calling invalidateSize() / validateSize(), but neither works.

Below are 3 classes which will illustrate the problem. Clicking the button in the item renderers resizes the renderer. The grid should also expand so that all of the 3 renderers are shown in their entirety.

Any suggestions would be greatly appreciated.

Regards

Marty

DataGridProblem.mxml (Application file)

<mx:Application xmlns:mx='http://www.adobe.com/2006/mxml' layout='vertical'     xmlns:view='view.*'>     <mx:ArrayCollection id='dataProvider'>         <mx:String>Item A</mx:String>         <mx:String>Item B</mx:String>         <mx:String>Item C</mx:String>     </mx:ArrayCollection>     <view:TestDataGrid         id='dg'          dataProvider='{ dataProvider }'         width='400'>         <view:columns>             <mx:DataGridColumn dataField='text' />             <mx:DataGridColumn itemRenderer='view.RendererButton' />         </view:columns>     </view:TestDataGrid> </mx:Application> 

view.TestDataGrid.as

package view {     import flash.events.Event;      import mx.controls.DataGrid;     import mx.core.ScrollPolicy;      public class TestDataGrid extends DataGrid     {         public function TestDataGrid()         {             this.verticalScrollPolicy = ScrollPolicy.OFF;             this.variableRowHeight = true;             this.addEventListener( RendererButton.RENDERER_RESIZE , onRendererResize );         }         private function onRendererResize( event : Event ) : void         {             resizeDatagrid();         }         private function resizeDatagrid():void         {             height = measureHeightOfItems(0, dataProvider.length ) + headerHeight;         }     } } 

view.RendererButton.mxml

<?xml version='1.0' encoding='utf-8'?> <mx:HBox xmlns:mx='http://www.adobe.com/2006/mxml'>     <mx:Button width='50' height='50'         click='onClick()' />      <mx:Script>         <![CDATA[              public static const RENDERER_RESIZE : String = 'resizeRenderer';             private function onClick() : void             {                 this.height += 20;                 dispatchEvent( new Event( RENDERER_RESIZE , true ) );             }         ]]>     </mx:Script> </mx:HBox> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T11:19:10+00:00Added an answer on May 11, 2026 at 11:19 am

    For what it’s worth, I never managed to resolve this issue. Code quickly became obsessed with dealing with edge cases.

    I ended up throwing out the dataGrid approach, and wrote a solution using VBox & HBox to facilitate resizing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 110k
  • Answers 110k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You would probably need a second thread. An easy option… May 11, 2026 at 9:38 pm
  • Editorial Team
    Editorial Team added an answer I believe the problem here is that there is no… May 11, 2026 at 9:38 pm
  • Editorial Team
    Editorial Team added an answer I think you've got 2 choices here: 1.Implement drawing yourself… May 11, 2026 at 9:38 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.