Flex/LCDS服务器到数据源的分页

Tra*_*sen 39 java apache-flex dataservice lcds

我正在尝试将服务器设置为数据源分页服务.我已经设置了所有内容,以便我调用汇编程序并返回值,但是我没有收到"分页"调用.

特别:

public Collection fill(List fillArgs, int begin, int rows)
Run Code Online (Sandbox Code Playgroud)

始终使用begin == -1和调用rows == -1,而不是通过页面获取实际值.此外:

public boolean useFillPage(List fillParameters)
Run Code Online (Sandbox Code Playgroud)

永远不会被调用(我的实现总是为所有参数返回true).看起来它永远不会被调用,因为JavaAdapter没有从Flex客户端接收pageSize头.

这是我的目标配置:

<destination id="invoiceListDataService">
  <adapter ref="java-dao" />
  <properties>
    <scope>session</scope>
    <source>com.williams.finance.invoice.dao.InvoiceReviewListAssembler</source>
    <network>
      <paging enabled="true" pageSize="100" />
    </network>
    <metadata>
      <identity property="invoiceNumber"/>
    </metadata>
  </properties>
</destination>
Run Code Online (Sandbox Code Playgroud)

我的Flex代码用于调用数据服务:

myDataService = new DataService("invoiceListDataService");
myDataService.autoSyncEnabled=false;
myDataService.fill(invoiceReviewListModel.invoiceList, params);
Run Code Online (Sandbox Code Playgroud)

我在这里错过了什么吗?任何想法从哪里开始寻找?

Dom*_*edi 1

首先,您的适配器定义是什么?尝试这个:

<adapters>
    <adapter-definition class="flex.data.adapters.JavaAdapter" 
        id="java-dao"></adapter-definition>
</adapters>
Run Code Online (Sandbox Code Playgroud)

其次,将custom="true"属性添加到您的分页属性中。

<paging enabled="true" pageSize="100" custom="true"/> 
Run Code Online (Sandbox Code Playgroud)

第三,可能会改变你应用范围

第四,在目标定义中,添加adapter="java-dao",而不是对其进行引用。

<destination adapter="java-dao"  id="invoiceListDataService">
Run Code Online (Sandbox Code Playgroud)

第五,确保重写必要的方法(useFillPage、Collection fill 等)

@Override
public boolean useFillPage(List fillParameters)
{
    // enabling paged-fill for all fills
    return true;
}
Run Code Online (Sandbox Code Playgroud)

请参阅此线程以获取对类似问题的一些有用响应: http://www.mail-archive.com/flexcoders@yahoogroups.com/msg111746.html