Freeetje
Freeetje

Reputation: 523

CRM 2011 - Filtered Subgrids Search Functionality

I found a way how to make "Filtered Subgrids" work with JavaScript, but when I add the "Search Box" on the subgrid, it searches on all the records and not on the records that are the result of the filtering.

Basicly, the only thing we do is putting an "FetchXML" while we click on a row in "Subgrid A" and "Subgrid B" is getting the new "FetchXML". Unfortunately we can't search in "Subgrid B" anymore, it searches in "ALL" records, and it should only search in the new "FetchXML". Has someone made this work in CRM 2011?

The only thing I do, is the following :

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

Upvotes: 4

Views: 1977

Answers (3)

Akhilesh RAJPOOT
Akhilesh RAJPOOT

Reputation: 11

The setParameter function is no longer available. Now you can use SetParameter instead of it. Fortunately refresh function is still available. So change the function name in your code and it will work.

Upvotes: 1

Freeetje
Freeetje

Reputation: 523

Paul thx for your answer, it worked :) I search with the "F12"-tool what the ID is of the "Search"-button and then I can override it :

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

No It's my task to do the needed implementation, that the quickfind works like the normal one!

Upvotes: 1

Paul Way
Paul Way

Reputation: 521

Take a look at your effectiveFetchXml after the search. You'll notice that it doesn't include the effectiveFetchXml you initially passed to it.

Unfortunately, the only way around this is the hijack the search button to fire your own event. In your event pass the effectiveFetchXml you want including the value of the search box (e.g. inject something like this when searching "t"...

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

Upvotes: 3

Related Questions