I have an External list (Visual Studio created BCS model using Linq to SQL) with a filter on the ReadList method. External list and filter work.
I want to be able to set the filter dynamically through QueryString on the listview page. With SharePoint Designer I edit the listview and add a QueryString parameter to the XsltListView and configure the Finder method with the parameter (similar to i.e.: http://arsalkhatri.wordpress.com/2012/01/07/external-list-with-bcs-search-filters-finders/).
I can now pass in the filter through QueryString - this works, and the list now displays items according to the filter. BUT this solution has the side-effect that the built-in filters on each column heading no longer works - I get an "This column type cannot be filtered" error. As soon as I remove the filter on the Finder method, the built-in filters start to work again.
Is it possible to combine passing a QueryString variable to the filter on the Finder method in the XsltListView and preserve the built-in functionality to filter by column headings?
Any ideas are greatly appreciated.
I actually found a solution to this. It seems the column filter functionality adds the token without parsing it. So if you have a filter defined as i.e. "{filtername}", this token string will literally be sent to the BCS as the filter value, including the curly braces. So you have to take actions for this by checking in your BCS code (and include all items when the filter passed = "{filtername}" ), or in case of SQL just add extra clause like this (last OR added compared to default generated SQL): WHERE ((@filtername IS NULL) OR ((@filtername IS NULL AND [] IS NULL) OR [] LIKE @CprNr) OR (@CprNr LIKE '%{filtername}%' ) )