Flex Dropdownlist itemrenderer 问题?
我正在使用 Spark DropDownlist 组件。我想保持父组件(所选项目显示的位置)的大小较小,但是当用户尝试选择一个项目时,显示选项的框我希望它变大这样它就包含所有元素,并且如果某个元素大于父组件的大小,它仍然适合,并且用户不必进行水平滚动。 我尝试使用具有各种宽度的 itemrenderer,但它会在选项上引入水平滚动。如果我在父组件(即 s:dropdownlist)上禁用水平滚动,则显示的选项将被截断,我的意思是某些文本不会显示。 您能为此建议一个可能的解决方案吗?
I am using a Spark DropDownlist component.I want to keep the size of the parent component (where the selected item shows up) small but when the user tries to select an item the box that shows up with the choices i want it to be big so that it contains all the elements and if an element is bigger then the size of the parent component it still fits in and the user will not have to do horizontal scrolling.
I tried using an itemrenderer with various widths but it brings in horizontal scrolling on the choices.If i disable horizontal scrolling on the parent component (i.e s:dropdownlist) then the choices that show up are cutoff, i mean some text is not shown.
Can you please suggest a possible solution for this ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我刚刚自己修好了。
基本上我为下拉列表创建了一个customskin,并在自定义列表中为PopupAnchor组件指定了这个属性popupWidthMatchesAnchorWidth =“false”。然后我创建了一个具有我需要的宽度的itemrenderer并且它起作用了。
注意:我创建了自定义皮肤对于dropdownlist,基于spark downdownlist已有的皮肤,只是修改了这个属性。
I just fixed it myself.
Basically i created a customskin for the dropdownlist and in the custom list i specified this property popupWidthMatchesAnchorWidth="false' for the PopupAnchor component. and then i created an itemrenderer with the width that i needed and it worked.
Note: i created the custom skin for dropdownlist, based on the existing sking of spark downdownlist and just modified this property.
我不知道这是否重要,但您可以像这样将您的解决方案放入开放事件中,
而无需创建皮肤。如果您尝试在创建完成时调用它,则弹出窗口尚未创建,您将收到错误消息。我注意到下拉列表更新时有轻微的闪烁。但这是一个调试版本,而且它非常轻微,以至于在发布版本中可能不会被注意到。
附录:我毕竟使用的是皮肤,因为内容是动态变化的,它可能比下拉菜单小。所以我注意到,当 popUpWidthMatchesAnchorWidth 设置为 false 时,弹出宽度默认为 140 或类似的值。为了解决这个问题,我添加了对列表宽度的绑定,因此弹出窗口将始终至少与列表一样宽,并在需要时变宽。为此,将 minWidth 属性添加到下拉皮肤的下拉列表中,如下所示:
I don't know if it counts but you can put your solution into the open event like so,
without creating a skin. If you try to call it on creation complete the popup isn't created yet and you'll get an error. I've noticed a slight flash where the dropdown is updated. But this is a debug build and it's so slight that it may not be noticeable in the release build.
Addendum: I am using the skin after all since the content is changing dynamically it can be smaller than the drop down. So I noticed that when popUpWidthMatchesAnchorWidth's set to false the pop up width defaults to 140 or something like that. To fix this I added a binding to the list's width so the pop up will always be at least as wide as the list and grow wider when it needs to. To do this add the minWidth property to the dropdown in the drop down skin like so: