Hey guys…I am trying something and getting a strange behavior.  I get an array of objects from the database that becomes the data provider for my datagrid.  I know the length of my data provider thanks to the myDataGrid.dataProvider.length method and I figure I could multiply that number by some arbitrary number of pixels to ensure that however many items are in my data provider, that’s how many rows are visible in my datagrid on the screen…so the datagrid is never scrollable.

 

I’m using a method that sets the dataprovider of the datagrid, myDataGrid.dataProvider = data; and then I’m calling myDataGrid.setSize(Stage.width – 35, myDataGrid.dataProvider.length * 25);

 

The Stage.width – 35 compensatesfor some other things on the screen to look proportionate and the myDataGrid.dataProvider.length * 25 is just guesstimating that each row in the datagrid component is about25 pixels high.  Well the first time I tried this, 25 was too large of a number so I adjusted it to 22, which seemed to work but still left me with a little extra bit of a final row visible.  Well that was livable.  Then I get aresult set back that only had 2 items in it, instead of the 5 I had been testing this whole thing with and now only one row was visble and you have to scroll down to see the second row, so I increased the 22 to 30 and that fixed it for that but now if I call the original result set with the 5 items, I can see a row anda half extra blank rows.  Is there a better way to dynamically show the number of rows based on the number of items in the data provider?  I wish there was a size attribute like there is with the HTML select list component where if it’s a list you can say I want x-number of rows visible.  I just don’t ever want the user to have to scroll within the datagrid…is there an easier way to do this?

 

Thanks!

 

This message contains information from Merlin Securities, LLC, or from one of its affiliates, that may be confidential and privileged. If you are not an intended recipient, pleaserefrain from any disclosure, copying, distribution or use of this information and note that such actions are prohibited. If you have received this transmission in error, please notify the sender immediately by telephone or by replying to this transmission.
 
Merlin Securities, LLC is a registered broker-dealer. Services offered through Merlin Securities, LLC are not insured by the FDIC or any other Federal Government Agency, are not deposits of or guaranteed by Merlin Securities, LLC and may lose value. Nothing in this communication shall constitute a solicitation or recommendation to buy or sell a particular security.

Reply via email to