【问题标题】:Disable autoscroll top on insertRowBefore in a TableView in Appcelerator/Titanium在 Appcelerator/Titanium 的 TableView 中禁用 insertRowBefore 上的自动滚动顶部
【发布时间】:2014-06-30 23:17:57
【问题描述】:
我目前正在使用 TableView 来显示 Appcelerator/Titanium 中的一些元素。
我遇到的问题是,当我进行拉动刷新并调用方法“insertRowBefore”使用以下方法在表的开头插入新元素时:
$.table.insertRowBefore(0,row);
表格自动滚动到顶部,当要插入很多行时,它看起来有点糟糕,我想保留当前位置。
有什么想法吗?
【问题讨论】:
标签:
titanium
titanium-mobile
appcelerator
appcelerator-mobile
titanium-alloy
【解决方案1】:
我遇到了同样的问题,在表格顶部插入行时它看起来很丑。我通过不直接在表中插入行而是先将它们插入数组来管理这种奇怪的行为:
//i suppose that you have an initial array contain your old rows oldRows
//add rows in the top
for(int i=0;i<7;i++)
oldRows.unshift(newRows[i]);
然后设置表格的数据
$.table.setData(oldRows);