简体   繁体   English

GXT Sencha复制列表存储

[英]GXT Sencha Copying a liststore

What is the best way to copy a ListStore? 复制ListStore的最佳方法是什么? I am aware that the ListStore does not have an iterator, so I was wondering if there is a more efficient way to copy this rather than the following code: 我知道ListStore没有迭代器,所以我想知道是否有一种比下面的代码更有效的方法来复制它:

private final ListStore<LineObject> storeA = new ListStore<LineObject>(new ModelKeyProv()); 
private ListStore<LineObject> storeB = new ListStore<LineObject>(new ModelKeyProv());

public void copy(){
    List<LineObject> lineListData = storeA.getAll();

    for(LineObject line: lineListData){
            storB.add(line);

    }

Try this code: 试试这个代码:

storeA.addAll(storeB.getAll());

This is the efficient way to copy a listStore data from one to another as far as I know. 据我所知,这是一种将listStore数据从一个复制到另一个的有效方法。 Thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM