我在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;
}
}
我想做的是:
答案 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
}