我在Smartface.io框架中工作,使用标签和重复框。就目前而言,我无法访问repeatbox的onSelectedItem,因为每行中的标签似乎都在前面,从而阻止了实际的重复框。有没有办法将标签发送到重复框后面?我已经尝试将z:“1”添加到lbl中,并将z:“8”添加到repeatBox1变量中。任何帮助将不胜感激。
由于
var lbl = new SMF.UI.Label({
top : "0%",
left : "0%",
width : "50%",
height : "100%",
z-index : "0",
fillColor : "#FFFFFF",
textAlignment : SMF.UI.TextAlignment.center
});
var repeatBox1 = new SMF.UI.RepeatBox({
width : "90%",
height : "40%",
left : "5%",
top : "10%",
z : "8",
showScrollbar : true,
fillColor : "white",
backgroundTransparent : true
});
repeatBox1.dataSource = qq;
repeatBox1.controls.
repeatBox1.onRowRender = function (e) {
this.controls[0].text = qq[e.rowIndex].users;
};
repeatBox1.onSelectedItem = function (e) {
//Pages.Page2.show();
alert("Selected " + (e.rowIndex + 1) + ". row");
};
repeatBox1.onRowDeleting = function (e) {
if (e.rowIndex === 0) {
alert("first row is deleted...");
}
};
repeatBox1.itemTemplate.height = Device.screenHeight / 7;
repeatBox1.itemTemplate.imageFillType = SMF.UI.ImageFillType.stretch;
repeatBox1.itemTemplate.add(lbl);
Pages.Page1.add(repeatBox1);
答案 0 :(得分:0)
标签无法像在重复框后面那样表现。 但是你可以使用label的e.rowIndex。触摸标签时,它返回e.rowIndex值。
var lbl = new SMF.UI.Label({
top : "0%",
left : "0%",
width : "50%",
height : "100%",
// z-index : "0",
fillColor : "#FFFFFF",
backgroundTransparent : false,
textAlignment : SMF.UI.TextAlignment.center,
onTouch : function (e) {
alert("index: " + e.rowIndex);
}
});