Spark List 是否支持 IDropInItemRenderer 接口?
看来新的 Spark List 组件不支持 IDropInItemRenderer 接口。
即 - 如果我在渲染器上实现 IDropInItemRenderer,则永远不会调用 listData 的设置器。
我是否遗漏了什么,或者这个界面现在已被弃用?
如果是这样,向渲染器提供类似 dataProvider 上下文信息的建议方法是什么?
例如,我希望集合中最后一项的渲染器的行为略有不同。
我看到 IItemRenderer
现在定义了一个 listIndex
属性,但是如果不知道源 dataProvider 的计数,这种方法就不起作用。
It appears as though the new spark List component does not honour the IDropInItemRenderer
interface.
Ie - if I implement IDropInItemRenderer
on my renderer, the setter of listData
is never called.
Am I missing something, or is this interface now deprecated?
If so, What is the suggested approach for providing similar dataProvider context information to the renderer?
For example, I want the renderer for the last item in a collection to behave slightly differently.
I see that IItemRenderer
now defines a listIndex
property, however this approach doesn't work without knowing the count of the source dataProvider.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是我最终使用的解决方法。
DataGroup 以它自己的方式体现了 Spark 的组合优势,因为它公开了 rendererUpdateDelegate 属性,您可以使用自己的类来设置该属性,以提供您想要的任何自定义功能。重新之后。
虽然令人沮丧的是,该界面在没有真正宣传的情况下就被删除了,但这种方法更强大。
这是一个示例类。在我的示例中,我希望最后一个渲染器的
collapsable
属性设置为false
:这是示例用法:
Here's the workaround I've ended up using.
In it's own way, the
DataGroup
is dripping Spark's compositional goodness, in that it exposes arendererUpdateDelegate
property, which you can set with your own class to provide whatever custom functionliaty you're after.While it's frustrating that the interface got dropped without really being advertised, this approach is much more powerful.
Here's an example class. In my example, I want the last renderer to have it's
collapsable
property set tofalse
:And here's it's example usage:
男人!只是花了很长时间试图找到 DataGroup.rendererUpdateDelegate(...),最终发现为什么我找不到,感谢这篇 SO 帖子。
不管怎样,考虑一下 rendererUpdateDelegate 属性(消失)和你提供的更多一点,我意识到这两者都不是真正必要的。
DataGroup
具有rendererAdd
事件,它可以在正确的时间为您提供足够的信息来执行您想要的操作;例如:...在
model
中,我们有:更少的代码行和更清晰的意图
Man! Just spent ages trying to find
DataGroup.rendererUpdateDelegate(...)
, eventually discovering why I couldn't, courtesy of this SO post.Anyway, thinking about the (disappearance of)
rendererUpdateDelegate
property and your offering a little bit more, I realise neither are really necessary.DataGroup
has therendererAdd
event which gives you enough info, at the right time, to do what you want; for example:...and in the
model
we have:Fewer lines of code and clearer intent