我想在每行/单元格中使用带有TextField和TextView的RadListView构建列表。该列表正确显示,但是当列表足够长时间滚动并且我在输入字段中输入任何内容(例如“hello”)并滚动时,“hello”将随机移动到不同的项目。Nativescript RadListView输入元素值在滚动时跳转
示例: 列出50行。我在第1行的文本框中输入“hello”。向下滚动,以便第1行不再可见。 “Hello”出现在第12行的文本字段中。我滚动回第1行,文本字段为空。我向下滚动到第12行和空,但“你好”现在显示了在排18的文本框...等
下面是代码:
import { Component } from "@angular/core";
class DataItem {
constructor(public id: number, public name: string) { }
}
@Component({
selector: "orderpage_rad",
template: `
<StackLayout>
<RadListView [items]="myItems">
<ng-template tkListItemTemplate let-item="item" let-i="index">
<StackLayout>
<Label [text]='"index: " + i'></Label>
<Label [text]='"name: " + item.name'></Label>
<TextField keyboardType="number" hint="quantity"></TextField>
<TextView hint="enter text" editable="true"></TextView>
</StackLayout>
</ng-template>
</RadListView>
</StackLayout>
`
})
export class orderComponent_rad {
public myItems: Array<DataItem>;
private counter: number;
constructor(){
this.myItems = [];
this.counter = 0;
for (var i = 0; i < 50; i++) {
this.myItems.push(new DataItem(i, "data item " + i));
this.counter = i;
}
}
}
我正在与正常nativescript的ListView相同的结果,所以我不认为它是一个错误。
我该如何解决这个问题?
我使用的角度与打字稿,至今只测试在Android:
TNS --version:3.1.2
跨平台模块版本:3.1.0