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

时间:2009-02-04 22:54:34

标签: java flex dataservice lcds

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

具体做法是:

public Collection fill(List fillArgs, int begin, int rows)
始终使用begin == -1rows == -1调用

,而不是通过页面获取实际值。另外:

public boolean useFillPage(List fillParameters)
永远不会调用

(我的实现总是为所有参数返回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>

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

myDataService = new DataService("invoiceListDataService");
myDataService.autoSyncEnabled=false;
myDataService.fill(invoiceReviewListModel.invoiceList, params);

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

2 个答案:

答案 0 :(得分:1)

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

<adapters>
    <adapter-definition class="flex.data.adapters.JavaAdapter" 
        id="java-dao"></adapter-definition>
</adapters>

其次,将 custom =“true”属性添加到分页属性。

<paging enabled="true" pageSize="100" custom="true"/> 

第三,可能会将范围更改为应用

第四,在目标定义中,添加adapter =“java-dao”而不是引用它。

<destination adapter="java-dao"  id="invoiceListDataService">

第五,确保你覆盖了必要的方法(useFillPage,Collection fill等)。

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

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

答案 1 :(得分:1)

您的目标配置看起来已完整。

仔细检查你的汇编程序是否扩展了AbstractAssembler:

public class InvoiceReviewListAssembler extends AbstractAssembler 

并且您至少会覆盖以下内容:

@Override
public int count(List arg0) {
    return -1; // or return the collection length.
}

@Override
public boolean useFillPage(List fillParameters) {       
    return true;
}

@Override
public Collection fill(List fillParameters,
                       PropertySpecifier ps,
                       int startIndex,
                       int numItems) {
   // TODO
}
相关问题