I've got a map object which has a dynamic map service layer (myLayer) in it that I'm using as to populate a legend. The legend.layers property is being set to that dynamic map service layer (legend.layers = [myLayer]). In this app, the user is restricted to pick and only show one "layer" out of the 30+ "layers" within myLayer. With the legend turned on, the user should see only the legend item for the single "layer" that they have turned on at any given time.
This is all working fine except that it seems that the legend component draws each legend item a little lower than the previous one in the myLayer TOC layer list, so if the user turns on the 35th layer in myLayer, the legend draws up with a vertical scroll bar that you have to scroll through a bunch of blank space to finally get to the desired legend item.
I've attached two screen shots. noBlankSpace.jpg shows the legend when the user draws only the first "layer" in myLayer. If the user picks, say... the 20th "layer" in myLayer to draw... it looks like what you see in lotsOfBlankSpace.jpg. If the user picks the 30th "layer" in myLayer, they need to scroll down a window of blank space before they see the legend item.
There seems to be a direct correlation between how far down the the "layer" is in the published MXD TOC and how much blank space precedes the legend item to be drawn.
Not sure how to fix this but it's pretty tough on users to have to scroll through a bunch of dead air to see legend items.