webOS上的List组件在modelChanged后遇到空白问题
昨晚在优化那个电影应用的时候发现一个问题,就是在webOS上进行ListModel的modelChanged时遇到空白问题,但是滑动屏幕内容又可以显示出来,经过查询官方论坛这个问题是已知一个bug,不过大家可以通过其他途径来绕过这个问题,例如下面的一种解决办法:
this.scroller = this.controller.getSceneScroller(); this.pageY = this.scroller.mojo.getScrollPosition().top; this.scroller.mojo.scrollTo(undefined, this.pageY, true);
通过scrollTo让modelChanged滚动到当前位置,不过这个办法还是会造成屏幕闪一下,不过基本解决了空白问题了。
官方论坛的开发者还提及另外一种解决办法,不过我没有试成功,我也引出来,大家可以试试:
this.listElement.mojo.noticeUpdatedItems(0, this.listModel.items); this.listElement.mojo.setLength(this.listModel.items.length);
参考:
1、http://developer.palm.com/distribution/viewtopic.php?f=11&t=6242
2、http://developer.palm.com/distribution/viewtopic.php?f=11&t=1823&start=0
3、https://developer.palm.com/distribution/viewtopic.php?f=11&t=6242&p=35842

