Something needs to constrain the height of the list (and probably set minHeight=0 on the list).
Thanks, that's what I thought, but setting min/max height isn't solving the problem.
protected function myDG_selectionChangeHandler(event:GridSelectionEvent):void
var selItems:Vector.<Object> = event.currentTarget.selectedItems;
var numItems:Number = selIndices.length;
for (var i:Number = 0; i<numItems; i++)
selectedItemsList.dataProvider.addItem(selItems[i]); //this works to add items to the list, but the list expands in size without adding scrollbars.
How is the List constrained by its parents? Show us the MXML surrounding the List.
here's the mxml for both the datagrid and the list. I included the datagrid because the code posted earlier is related. This is, a round-about way of studying your datagrid checkbox itemRenderer. Just seein' how Vector.<Object> works you know I suppose I should point out that the datagrid is populated from a sqlite table. That's the only other code in the file.
<fx:Object bookID="ID " title="The Title of a Book Goes Here"/>
<mx:HBox horizontalAlign="center" verticalAlign="middle" height="100%" width="100%">
<s:GridColumn dataField="bookID" headerText="ID"/>
<s:GridColumn dataField="title" headerText="Title"/>
The List doesn’t have a specified height so it can grow. I’m not sure why maxHeight isn’t taking effect. It isn’t clear from your code snip whether DataGrid and List are actually adjacent tags in the MXML file. There is also requestedRowCount property that might be helpful.
There is a skill to putting the right amount of code in a post. Too much code and nobody will read it, but too little leaves too much ambiguity.
I'm using Flash Builder 4.5.
I couldn't find a requestedRowCount property in code assist for the Spark List.
But, actually defining the height of the list solved the problem. I knew I was missing something.
Like so many other things, I was looking for a complicated answer to a simple problem.
BTW, does tag proximity really affect performance as you suggest?
The child tags of a container can affect performance and visuals. That’s why I don’t like code snips and encourage everyone to comment enough stuff out to boil it down to about 20 lines that actually run.
For example, if you said your List took a long time to appear, but it was in the same Hgroup as the DataGrid, it could be the DataGrid slowing things down, not the List, or some interaction between the two. In the snips you posted, I had to consider the DataGrid’s layout attributes in case it could be affecting how the List gets sized. If I know the DG is in a different container either via the example code or careful description, then I know it is just a List issue.
It therefore took me longer to read and reply. Since answering forum posts is not an official part of my job, and I can only sneak in a certain amount of time to do it, it means that some other post will not be read and answered. Also, people tend to learn a lot and often discover the answer themselves when boiling down the code to a simple test case.
I kinda wondered why you asked me about the parent of the list. My list and DG were not in any container. Aside from setting up db access and a sqlstatement, those were the only 2 elements.
But thanks for the help. I mean that sincerely.
I am usually not too quick to jump on the forum. I usually spend a considerable amount of time scanning the net. But I have been guilty of asking too quickly a time or two. And sometimes I've even started out writing a question and found myself answering it.