如何隐藏虚拟转发器中的行?

时间:2011-08-16 17:55:30

标签: webos palm enyo

我在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将停止渲染行。

1 个答案:

答案 0 :(得分: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) {
      // 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
}