Dynamics CRM 2011过滤器子网格和刷新
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Dynamics CRM 2011过滤器子网格和刷新相关的知识,希望对你有一定的参考价值。
Filters a dynamics CRM 2011 subgrid...implementation example included at bottom
if (typeof (EASI) == "undefined") { EASI = {}; } EASI._construct = function () { //filter subgrid and refresh function this.FilterSubgridandRefresh = function (subgridname, stringArrayOfCondtionsToAdd, removeExistingConditionsBool) { try { window.setTimeout(function () { var subgrid = document.getElementById(subgridname); if (subgrid == undefined || subgrid == null) { } var oldFetch = $("#" + subgridname).find("#effectiveFetchXml").attr("value"); if (oldFetch == undefined) { //we have to refresh the grid now because it was in a tab that was collapsed so it hasn't run yet subgrid.control.refresh(); //re-run this operation setTimeout(function () { EASI.FilterSubgridandRefresh(subgridname, stringArrayOfCondtionsToAdd, removeExistingConditionsBool); }, 1000); } else { if (removeExistingConditionsBool)//remove the existing conditions html_fetch.find("condition[operator!='']").remove(); for (var i in stringArrayOfCondtionsToAdd) { var cond = $(stringArrayOfCondtionsToAdd[i]); html_fetch.find("filter").append(cond); } var newFetch = html_fetch.html(); subgrid.control.SetParameter("fetchXml", newFetch); subgrid.control.refresh(); } }, 1000); } catch (err) { alert("Error in subgrid refresh " + err.message); } } //get crm field value function this.GetFieldValue = function (fieldlogicalname) { if (typeof (Xrm) == "undefined") Xrm = window.parent.Xrm; var atype = Xrm.Page.getControl(fieldlogicalname).getAttribute().getAttributeType(); if (atype == this.CRM.type_optionset) { return this.GetPicklistSelectedValue(fieldlogicalname); } else if (atype == this.CRM.type_lookup) { return this.GetLookupId(fieldlogicalname); } else { return Xrm.Page.getControl(fieldlogicalname).getAttribute().getValue(); } } } EASI._construct(); /*here is an implementation example*/ function filterGrid_Load() { var oid = $("#opportunityid").attr("value"); var configno = EASI.GetFieldValue("easi_configurationno"); FilterSubGrid_OppDetailSubgrid("DoNotRemove_options_subgrid", oid, configno, 101); function FilterSubGrid_OppDetailSubgrid(subgridname, oppid, configno, lineitemtype) { try { var newcond1 = "<condition attribute="easi_configurationno" operator="eq" value="" + configno + "" />"; var newcond2 = "<condition attribute="opportunityid" operator="eq" value="" + oppid + "" />"; var newcond3 = "<condition attribute="easi_lineitemtype" operator="eq" value="" + lineitemtype + "" />"; var newcond4 = "<condition attribute="easi_removeoption" operator="ne" value="" + 1 + "" />"; var condArray = new Array(newcond1, newcond2, newcond3, newcond4); EASI.FilterSubgridandRefresh(subgridname, condArray, true); } catch (err) { alert("error filtering subgrid: " + err.message); } } }
以上是关于Dynamics CRM 2011过滤器子网格和刷新的主要内容,如果未能解决你的问题,请参考以下文章
Dynamics CRM 2011 - 如何更改现有 CRM 实例的活动目录服务器?
EndpointNotFound 异常 - Dynamics CRM 2011
sql 在另一个用户的背景下阅读MS Dynamics CRM过滤视图