0

I want an XsltListViewWebPart filtered based on some custom metadata derived from the current user. Following Claudio Brotto’s article http://blog.claudiobrotto.com/2012/extending-base-xslt-web-parts-with-custom-control-bindings , I created a web control that returns a caml query fragment containing my dynamic filters. I added then a parameter binding which modifies the original caml query adding this fragment to it.

The filtering seems to work but I had now two problems: - The heading column filters don’t work anymore - The element group counter is correct but when I expand the element group list the items inside are not filtered

The query fragment result from binding is:

<In><FieldRef Name='Title'/><Values>
  <Value Type='Text'>MP016</Value>
  <Value Type='Text'>MP150</Value>
</Values></In>

enter image description here

        <WebPartPages:XsltListViewWebPart runat="server" .......>
    <DataFields/>
    <ParameterBindings>
        ........
        <ParameterBinding Name="CAMLQueryValuesCodiciPdv" Location="Control(CamlQueryPdvFilter1,Caml)" DefaultValue="&lt;IsNotNull&gt; &lt;FieldRef Name='ID' /&gt; &lt;/IsNotNull&gt;"/>
    </ParameterBindings>
    <XmlDefinition>
        <View>
            <Query>
                <GroupBy Collapse="TRUE" GroupLimit="30">
                    <FieldRef Name="pippo"/>
                </GroupBy>
                <Where>
                    <And>
                        {CAMLQueryValuesCodiciPdv}
                        <Or>
                            <Eq>
                                <FieldRef Name="pippo"/>
                                <Value Type="Text">bolla</Value>
                            </Eq>
                            <Eq>
                                <FieldRef Name="pippo"/>
                                <Value Type="Text">fattura</Value>
                            </Eq>
                        </Or>
                    </And>
                </Where>
            </Query>
            <ViewFields>
                <FieldRef Name="pippo"/>
                <FieldRef Name="LinkTitle"/>
                <FieldRef Name="plluto"/>
            </ViewFields>
            <RowLimit Paged="TRUE">30</RowLimit>
            <Aggregations Value="Off"/>
            <Toolbar Type="Freeform"/>
        </View>
    </XmlDefinition>
</WebPartPages:XsltListViewWebPart>

<GS:CamlQueryPdvFilter runat="server" id="CamlQueryPdvFilter1" ColumnFilterInternalName="Title"></GS:CamlQueryPdvFilter>

How can I resolve this?

1

The parameters binding work if the XsltListViewWebPart's AsyncUpdate property is true.

https://sharepoint.stackexchange.com/a/21077/20627

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.