Question

I'm working on a filter web part inherited from another developer and it's the first time I've worked on them. It currently allows for a single filter and another filter needs to be added. Initial thoughts are something like:

// Existing filter property
[ConnectionConsumer("ProgramEntityLevel", "ProgramEntityLevel", AllowsMultipleConnections = true)]
// New filter property
[ConnectionConsumer("ProgramEntityGuid", "ProgramEntityGuid", AllowsMultipleConnections = true)]
public void SetFilter(IFilterValues filterValues)
{
    // ...
}

However of course it's not possible to have multiple ConnectionConsumer attributes.

Any ideas?

Was it helpful?

Solution

I presume you are using the ITransformFilterValues (or similar) interface? You may want to consider implementing the obsoleted filter interfaces instead, since by going via IFilterProvider you can simply send a FilterString such as Filter1=Value1&Filter2=Value2 to your connected consumer Web Parts.

When we developed FilterZen, we implemented the interface you used (for sending "multiple values") as well as the obsoleted interfaces (for sending "multiple filters"). This allowed for greatest compatibility with out-of-box and third-party consumer Web Parts.

OTHER TIPS

Its not entirely clear what you want to achieve, so maybe if you could clearify the specs for the task?

I dont think you can have two filters in one filter web part.

Arguably a better design would be to split it up in two filter web parts, but according to this thread, the design for AllowMultipleConnections is that a provider can have more than one consumer, but not the other way around. At the end of the thread this however there seems to be some confusion to if that is the case or not, so you could test it.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top