设置子网格过滤条件
有时候需要设置子网格不显示当前表单实体的相关记录,而是显示与其他查找字段的相关记录,可配置如下

再加上以下代码,即可实现仅显示与客户关联的stock记录。
"use strict";
var AEntityForm = window.AEntityForm || {};
(function () {
this.formOnLoad = function (context) {
this.setStockGridFilter(context);
};
// 设置子网格过滤条件
this.setStockGridFilter = function (context) {
let stockGrid = context.getFormContext().getControl('cc_1698115806549');
if (stockGrid != null) {
let accountField = this.getAttrValue(context, 'apv_account_r1');
if (accountField != null && accountField.length > 0) {
let FetchXml = `<fetch version="1.0" output-format="xml-platform" mapping="logical" no-lock="false" distinct="false">
<entity name="apv_accountstock">
<attribute name="apv_name"/>
<filter type="and">
<condition attribute="apv_account_r1" operator="eq" value="${accountField[0].id}" />
</filter>
</entity>
</fetch>`;
stockGrid.setFilterXml(FetchXml);
stockGrid.refresh();
}
}
}
}).call(VisitRecordForm);
从官方文档中并没有找到setFilterXml方法
posted on 2023-12-06 11:26 Tencent/Tim 阅读(44) 评论(0) 收藏 举报
浙公网安备 33010602011771号