如何隐藏 VirtualRepeater 中的行?

发布于 2024-11-30 04:04:42 字数 688 浏览 1 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只是在用心讲痛 2024-12-07 04:04:42

我找到的解决方案很简单:

{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) {
      // code to update every row 

  } else {  // we don't want this row to show
      this.$.eventItem.setShowing(false);
  } 
 return true; // if you don't return true, the virtual Repeater stops fetching rows
}

The solution I've found is simple:

{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) {
      // code to update every row 

  } else {  // we don't want this row to show
      this.$.eventItem.setShowing(false);
  } 
 return true; // if you don't return true, the virtual Repeater stops fetching rows
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文