0

在自定义 itemrender 中加载图像以供列表的好地方。我尝试在 createChildren 中为图像创建我的持有者,但尚未设置数据。我认为数据功能不行,因为每次用户滚动时都是 calinig。

4

2 回答 2

0

You didn't tell us what the image is and how it relates to your itemRenderer. Here are a few options:

If your image will not change based on the data then create your image class in createChildren(). Set the property on it in the createChildren() method; if it is static. If it is something that may change you may consider setting it in commitProperties().

If your image will change based on the data; then you should change it either in the set data method or in a dataChange event handler. I prefer the latter, but that is just preference. An itemRenderer is re-used as the list is scrolled. So the data that your renderer represents changes with it; and so should your visual display.

If lots of the elements of your dataProvider may use the same image; you can write conditional logic to determine whether or not the image should be loaded again. This would prevent the image from reloading again unnecessarily.

于 2013-01-21T00:43:51.067 回答
0

您需要将 data/url 设置为commitProperties.

于 2013-01-20T16:56:34.650 回答