Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
GWT SimplePager LastButton问题_Gwt_Pager_Gwt 2.2 Celltable_Gwt Celltable - Fatal编程技术网

GWT SimplePager LastButton问题

GWT SimplePager LastButton问题,gwt,pager,gwt-2.2-celltable,gwt-celltable,Gwt,Pager,Gwt 2.2 Celltable,Gwt Celltable,我面临SimplePage最后一个按钮的问题。 我在celltable中有3个页面,页面大小=11(1条空记录+10条记录(带值)),总记录=26 我通过扩展SimplePage使用CustomerPage 在第一次尝试中,celltable中显示1+10条记录:下一页和最后一页按钮已启用(第一页和上一页按钮已禁用),这是正确的。 但“最后一页”按钮不起作用…:(不知道是什么问题…(事件未触发) 奇怪的行为: @1“最后一页”按钮仅在我访问最后一页(我的情况下为3页)时起作用 @2假设我在第1页

我面临SimplePage最后一个按钮的问题。 我在celltable中有3个页面,页面大小=11(1条空记录+10条记录(带值)),总记录=26

我通过扩展SimplePage使用CustomerPage

在第一次尝试中,celltable中显示1+10条记录:下一页和最后一页按钮已启用(第一页和上一页按钮已禁用),这是正确的。 但“最后一页”按钮不起作用…:(不知道是什么问题…(事件未触发)

奇怪的行为:

@1“最后一页”按钮仅在我访问最后一页(我的情况下为3页)时起作用

@2假设我在第1页n我移动到第2页(celltable中总共3页)。此时所有按钮都已启用,这是正确的。 在这种情况下,最后一个按钮起作用,但其行为与下一个按钮类似

我的GWT应用程序集成到我们的一个产品中,因此无法从客户端进行调试

可能是AbstractPager的setPage(int index)方法中的索引值不正确

最后一个按钮的代码流程如下所示

//From SimplePager

lastPage.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
          lastPage();
        }
      });


       @Override
  public void lastPage() {
    super.lastPage();
  }

 // From AbstractPager
  /**
   * Go to the last page.
   */
  protected void lastPage() {
    setPage(getPageCount() - 1);
  }
 protected void setPage(int index) {
    if (display != null && (!isRangeLimited || !display.isRowCountExact() || hasPage(index))) {
      // We don't use the local version of setPageStart because it would
      // constrain the index, but the user probably wants to use absolute page
      // indexes.
      int pageSize = getPageSize();
      display.setVisibleRange(pageSize * index, pageSize);
    }
  }
或者上述代码中的某些条件为false(来自setPage())

实际记录=26和3条空记录(第一条空记录/页)

可能b数据大小有问题:|

如何根据数据大小检查页数? ?


如何解决这个问题?

在没有看到更多代码的情况下,这是一个很难回答的问题,因为可能有多个地方出现了问题

我会确保您在SimplePage上调用
setDisplay(…)
,以便它拥有计算其范围所需的数据


如果您不能在devmode中运行,我建议您在浏览器中设置一些GWT日志记录(例如,将日志写入弹出面板或其他内容)。

编辑:我发现寻呼机的默认构造函数没有给您一个“last”按钮,而是一个“快进1000行”按钮(很可怕,对吧?)

像这样调用以下构造函数,并查看问题是否已解决:

protected void onRangeChanged(HasData<RecordVO> display) {
//----- Some code --------
cellTable.setRowCount(searchRecordCount, false);
//----- Some code --------
}

SimplePager.Resources Resources=GWT.create(SimplePager.Resources.class);
SimplePager SimplePager=新SimplePager(TextLocation.CENTER,resources,false,1000,true);

第一个“false”标志关闭“fastforward”按钮,最后一个“true”标志打开“last”按钮

另外,只有当寻呼机知道您拥有的记录总数时,最后一个按钮才会起作用

您可以调用表的setRowCount函数来更新总计,如下所示:


int totalRecordsSize=26;//您拥有的记录总数
boolean isTotalExact=true;//它是估计值还是精确匹配
table.setRowCount(totalRecordsSize,isTotalExact);//设置表的总数并更新寻呼机(假设您以前调用过pager.setDisplay(table))


如果您使用的是附加的数据提供程序,那么它的updateRowCount方法(用法相同)。

我认为问题与
setPage()
中的条件有关。请尝试将SOP放在
if
条件之前,或者调试代码仅添加了
cellTable.setRowCount(int size,boolean isExact)
在OnRange更改方法AsyncDataProvider中。我的问题已解决:)

protectedvoid onRangeChanged(HasData显示){
//-----一些代码--------
cellTable.setRowCount(searchRecordCount,false);
//-----一些代码--------
}

我认为问题与
setPage()中的条件有关。
。如果条件或调试代码,请尝试将SOP放在
之前[“寻呼机的默认构造函数不会给您一个“last”按钮,而是一个“fast forward 1000 line”按钮(可怕,对吧?)]是的,这真的很可怕。我刚刚花了一个下午来讨论这个问题。另外,请注意这个构造函数:SimplePage(simplePage.TextLocation,boolean showFastForwardButton,boolean showLastPageButton)