对SubGrid进行进一步筛选

对SubGrid中的数据进行进一步筛选
通常在一个主Form中会有一个普通字段和子网格(subgrid)。
例如:主表单中有一个客户字段(N:1),子网格中的数据与客户也有关联(N:1)。
当主Form中的客户字段变更时对应的子网格中的数据也需要跟着刷新。
假如主Form中的客户字段选择为(中国银行)则子网格中的所有数据中的客户也必须都为(中国银行)。
对此有两种解决方案:
1:当主Form中的客户字段变更时直接刷新subgrid。对subgrid的刷新事件追加以下操作。
对subgrid追加刷新事件
在onLoad时追加如下代码来对subgrid追加refresh事件
SubgridRefresh = function () {

//取得subgrid
var yardmototype= document.getElementById("yardmototype");

if (yardmototype== null) {
    //1second后重新调用
    setTimeout("SubgridRefresh ()", 1000);
} else {
    yardmototype.control.add_onRefresh(function () {
        var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"
                      + "<entity name='new_yardmototype'>"
                       + " <attribute name='new_yardmototypeid' />"
                       + " <attribute name='new_number' />"
                       + " <attribute name='createdon' />"
                       + " <order attribute='new_number' descending='false' />"
                       + " <filter type='and'>"
                       + "   <condition attribute='statecode' operator='eq' value='0' />"
                       + "   <condition attribute='new_custname' operator='eq' uitype='account' value='{D85136EB-A1AE-E511-80DA-005056AD06D3}' />"
                       + " </filter>"
                      + "</entity>"
                    + "</fetch>";

    //Set the fetchxml directly to subgrid
    yardmototype.control.SetParameter("fetchXml", fetchXml); //set the fetch xml to the sub grid

    yardmototype.control.Refresh(); //refresh the sub grid using the new fetch xml
    });

}

}

“`

2.注册一个Retrievemultiple 的插件,将传入进来的query表达式替换为实际业务需要的。但是这种情况下需要区分是哪种情况下触发的Retrievemultiple插件。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值