2012-04-19 70 views
4

我找到了一種方法如何使「被過濾的子網格」的工作與JavaScript的,但是當我添加了上次網格「搜索框」,它會搜索所有的記錄,而不是在記錄中是過濾的結果。CRM 2011 - 過濾的子網格搜索功能

基本上,我們所做的唯一事情就是在「子網格A」和「子網格B」中的某一行點擊一個「FetchXML」,並獲取新的「FetchXML」。不幸的是,我們不能在「子網格B」中搜索,它在「所有」記錄中搜索,它只應搜索新的「FetchXML」。有人在CRM 2011中做過這項工作嗎?

我唯一要做的,是這樣的:

//Setting the fetch xml to the sub grid. 
relatedSamples.control.setParameter("fetchXml", fetchXml); 
relatedSamples.control.setParameter("effectiveFetchXml", fetchXml); 
relatedSamples.control.setParameter("fetchXmlForFilters", fetchXml); 

//This statement will refresh the sub grid after making all modifications. 
relatedSamples.control.refresh(); 

回答

3

看看搜索後您的effectiveFetchXml。您會注意到它不包含您最初傳遞給它的effectiveFetchXml。

不幸的是,解決這個問題的唯一方法是劫持搜索按鈕發射自己的事件。在你的事件傳遞你想要的effectiveFetchXml包括搜索框的值(例如搜索「T」的時候注入這樣的事情...

<filter type="or"> 
<condition attribute="subject" operator="like" value="t%" /> 
<condition attribute="regardingobjectidname" operator="like" value="t%" /> 
</filter> 
+0

有你的方式如何傳遞事件... – Freeetje 2012-04-23 12:56:21

1

保羅THX你的答案,它的工作:)我與搜索「F12」 - 工具的ID爲「搜索」按鈕上的東西,然後我可以重寫它:

if (document.getElementById("ModulesPlannedChoice_findCriteriaButton") != null) document.getElementById("ModulesPlannedChoice_findCriteriaButton").onclick = function() { refreshModulesPlanned(); } 
var searchValue = (document.getElementById("ModulesPlannedChoice_findCriteria") != null ? document.getElementById("ModulesPlannedChoice_findCriteria").value : ""); 

沒有這是我的任務,做必要的實施,將快速查找作用類似於普通的一個!

1

的setParameter功能不再可用。現在您可以使用SetParameter代替它。幸運的是,刷新功能仍然可用。所以改變代碼中的函數名稱就可以了。