3 Replies Latest reply on Oct 22, 2011 8:13 PM by xandout

    Newbie question, How do I resize a datagrid to always fit contents?

    nathanp812

      Hi there,

       

      I am sure this is a question that has been asked time and time again so please forgive me if I am going over old ground.

      I just discovered flex 4.5 about a week ago and am absolutely amazed by the power it gives me and how easy it was to pick up.... There is one problem I am struggling with however.

       

      How do I resize to mx or spark datagrid to fit contents?

       

      I come from using more traditional solutions (.net aspx) and I am used to (and quite like) the way that a datagrid or list view control will automatically resize itself to fit how many rows it has to display.

       

      I have accepted the fact that I need to place scroll bars on the outer container so that the user can scroll down to see the content (I would like a dynamically resizing application eventually), however no matter what I do the datagrid items in my flex application never seem to fit the content.

      I looked around the internet and there seem to be plenty of people saying that it can be done, and plenty of example code provided for that matter, but a lot of it seems relevant to flex 2/3 and does not seem to work in my situation.

       

      Any advice would be greatly appreciated.