代码之家  ›  专栏  ›  技术社区  ›  Marc Jonkers

ft搜索视图的行数

  •  0
  • Marc Jonkers  · 技术社区  · 13 年前

    我对一个视图进行了搜索。我想知道在这次搜索之后这个视图有多少行。我试过了 rows = view1.getEntryCount();

    但这给出了“原始”视图的行数,而不是我搜索的结果。

    编辑 以下方法有效,但效率不高。 有更好的主意吗?

    productTest=sessionScope.get("product");
    landTest=sessionScope.get("country");
    var length = view1.getEntryCount();
    var entries = view1.getAllEntries();
    var i = 0;
    var rows = 0;
    var currentEntry = entries.getFirstEntry();
    while(i < length){
    land = currentEntry.getColumnValues().elementAt(0);
    prod = currentEntry.getColumnValues().elementAt(1);
    if (land == landTest & prod == productTest)
        {
        rows++;
        }
    currentEntry = entries.getNextEntry();
    i++;
    }
    viewScope.queryString = rows;   `
    
    2 回复  |  直到 13 年前
        1
  •  1
  •   Community Mohan Dere    6 年前

    我在我的博客上发现了这个。如果仍然有效,请尝试:

    var entryCount=viewData.getEntryCount();

    var viewControl=getComponent('viewControlId');

    var rowCount=viewControl.getRowCount();

    //如果搜索处于活动状态->行数,其他条目数

    var count=(viewControl.getDataSource().getSearch())?rowCount:entryCount;

        2
  •  0
  •   biegleux piyush    13 年前

    请尝试一下

    rows = view1.getrowlines