我在页面中添加了Repeatbox。我得到了json数据。我将useActiveItem设置为true。当我点击数据时,selectedItem正在隐藏。所以,标签是隐藏的。我想给行选择效果。我怎样才能做到这一点。我的代码如下。
//Data Source
var myDataSource = [{
row : "First Row"
}, {
row : "Second Row"
}, {
row : "Third Row"
}
];
//label element to be included
var lbl = new SMF.UI.Label({
top : "0%",
left : "0%",
width : "100%",
height : "100%",
fillColor : "#FFFFFF",
textAlignment : SMF.UI.TextAlignment.center,
touchEnabled:false
});
//repeatbox list
var repeatBox1 = new SMF.UI.RepeatBox({
width : "100%",
height : "80%",
left : "0%",
top : "0%",
showScrollbar : true
});
repeatBox1.dataSource = myDataSource;
repeatBox1.onRowRender = function (e) {
this.controls[0].text = myDataSource[e.rowIndex].row;
};
repeatBox1.onSelectedItem = function (e) {
alert("Selected " + (e.rowIndex + 1) + ". row");
};
repeatBox1.onLongTouch = function (e) {
alert("first row is deleted...");
};
repeatBox1.itemTemplate.height = Device.screenHeight / 7;
repeatBox1.itemTemplate.imageFillType = SMF.UI.ImageFillType.stretch;
repeatBox1.itemTemplate.add(lbl);
repeatBox1.useActiveItem=true;
Pages.Page4.add(repeatBox1);

Pages.Page4.add(repeatBox1);
答案 0 :(得分:0)
您必须在Repeatbox中设置每种类型的元素的样式(非活动,活动,标题等)。要做到这一点,请转到设计视图并选择重复框,然后您会看到一个下拉菜单,您可以选择不同类型的元素。点击" Active Item"并且您会注意到行样式再次是默认的。现在为您设置活动样式的样式。就是这样。 :)