如何隐藏 VirtualRepeater 中的行?
我在 Enyo (WebOS 3.0) 中使用一个 VirtualRepeater:
{kind: enyo.VirtualRepeater, name: "eventList", onSetupRow: "setupRowWithEvent", onclick: "doListTap", components: [
{kind: enyo.Item, name:"eventItem", layoutKind: enyo.HFlexLayout, tapHighlight: true, components: [
/* components of every row: inside a Enyo.Item */
]}
]}
/* more code */
setupRowWithEvent: function(inSender, inIndex) {
if (somethingIsTrue) {
return true;
}
}
我想做的是:
- 如果某件事为真,则渲染该行,
- 如果不是,则不显示任何内容 问题是现在它显示空行,而不是什么也不显示。它显示包含内容的行和空行,但我不需要任何行。我不能返回 false,否则 VirtualRepeater 将停止渲染行。
I'm using one VirtualRepeater in Enyo (WebOS 3.0):
{kind: enyo.VirtualRepeater, name: "eventList", onSetupRow: "setupRowWithEvent", onclick: "doListTap", components: [
{kind: enyo.Item, name:"eventItem", layoutKind: enyo.HFlexLayout, tapHighlight: true, components: [
/* components of every row: inside a Enyo.Item */
]}
]}
/* more code */
setupRowWithEvent: function(inSender, inIndex) {
if (somethingIsTrue) {
return true;
}
}
What I want to do is:
- if something is true, render the row
- if not, show nothing
The problem is that now it's showing empty rows, instead of nothing. It shows rows with content and empty rows, but I want no rows. I can't return false, or the VirtualRepeater will stop rendering rows.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到的解决方案很简单:
The solution I've found is simple: