Javascript 如何在NativeScript radlistview中使用scrollToIndex
我的nativescript应用程序有问题 我试图在单击按钮时滚动到我的listview的底部,但是我得到一个错误:无法读取未定义的属性scrollToIndex。我知道这意味着getViewById找不到listview ID 这是我的代码(view model.js) 是否有其他方法可以访问ListView ID?最后修复了它Javascript 如何在NativeScript radlistview中使用scrollToIndex,javascript,nativescript,Javascript,Nativescript,我的nativescript应用程序有问题 我试图在单击按钮时滚动到我的listview的底部,但是我得到一个错误:无法读取未定义的属性scrollToIndex。我知道这意味着getViewById找不到listview ID 这是我的代码(view model.js) 是否有其他方法可以访问ListView ID?最后修复了它 const view = require("tns-core-modules/ui/core/view"); scrollToBottom: fu
const view = require("tns-core-modules/ui/core/view");
scrollToBottom: function (args) {
var button = args.object;
var parent = button.parent;
let mScroller = view.getViewById(parent, "myScroller");
//var mScroller = topmost().getViewById("myScroller");
//mScroller.LoadOnDemandMode = "Manual";
mScroller.scrollToIndex(10);
},
const view = require("tns-core-modules/ui/core/view");
scrollToBottom: function (args) {
var button = args.object;
var parent = button.parent;
let mScroller = view.getViewById(parent, "myScroller");
//var mScroller = topmost().getViewById("myScroller");
//mScroller.LoadOnDemandMode = "Manual";
mScroller.scrollToIndex(10);
},