在Appcelerator/Titanium的TableView中,在insertRowBefore上禁用自动滚动顶部[英] Disable autoscroll top on insertRowBefore in a TableView in Appcelerator/Titanium

本文是小编为大家收集整理的关于在Appcelerator/Titanium的TableView中,在insertRowBefore上禁用自动滚动顶部的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我目前正在使用tableView来在Appcelerator/Titanium中显示一些元素. 我所拥有的问题是,当我刷新刷新时,我调用方法" insertrowbefore ",以使用如下方式的方法在表开头插入新元素:

$.table.insertRowBefore(0,row); 

表自动滚动到顶部,当才能插入时,它看起来有点不好,我想保持当前位置. 任何想法?

推荐答案

我有同样的问题,在表的顶部插入行时,它看起来非常难看.我通过直接插入表中的行,但首先将它们插入数组:

,我已经管理了这个奇怪的行为
//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);

本文地址:https://www.itbaoku.cn/post/1938235.html

问题描述

i'm currently using a TableView to display some elements in Appcelerator/Titanium. The problem that i have is that when i make a pull to refresh and i call the method "insertRowBefore" to insert new elements at the beginning of the table using the method like following:

$.table.insertRowBefore(0,row); 

The table auto scrolls to top, and it looks a little bit bad when there're a lot rows to insert, i want to keep the current position. Any ideas?

推荐答案

I have had the same problem it looks very ugly when inserting rows at table's top. I have managed this strange behavior by not inserting rows in table directly but inserting them to an array first :

//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]);

then set table's data

$.table.setData(oldRows);