【问题标题】:Flex/LCDS Server-to-data-source PagingFlex/LCDS 服务器到数据源分页
【发布时间】:2010-10-05 13:17:35
【问题描述】:

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

具体来说:

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);

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

【问题讨论】:

  • 我会先查看那个 params 变量。它应该是一个包含“开始”和“行”信息的实例?也许您的 flex DataService 忽略了该参数。
  • @Travis,你刚才问过这个问题。你找到解决办法了吗?顺便说一句:我强烈推荐Charles Proxy 来满足您的网络调试需求。这是一个很棒的调试工具,可以帮助你弄清楚 flex 和服务器之间实际来回发送的内容。

标签: java apache-flex dataservice lcds


【解决方案1】:

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

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

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

<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

【讨论】:

    【解决方案2】:

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

    仔细检查您的汇编器是否扩展了 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
    }
    

    【讨论】:

      猜你喜欢
      • 2010-12-12
      • 2012-03-12
      • 2014-08-20
      • 2018-09-12
      • 2012-03-31
      • 2023-03-30
      • 2013-09-18
      相关资源
      最近更新 更多