How do I make a custom SPFieldUrl that can be filtered on through a list view web part?

Unanswered How do I make a custom SPFieldUrl that can be filtered on through a list view web part?

  • terça-feira, 3 de agosto de 2010 21:34
     
     

    We have a custom field derived from SPFieldUrl that is used in our product.  We would like to make it so that this field can be used to filter the contents of a ListViewWebPart using the IFilterValues interface.  As it stands though, when the connection to the ListView web part is established, fields based on our custom field don't appear as possible field to connect to.  I've overridden SPFieldUrl.Filterable, SPFieldUrl.FilterableNoRecurrence and SPFieldUrl.Sortable to return true (I would have thought only Filterable was necessary, but tried them all just in case), but that's apparently insufficient.  Is there any way this can be done by making modifications to our custom field, or will it require a custom web part to accomplish?

     

Todas as Respostas

  • segunda-feira, 19 de dezembro de 2011 14:44
     
     
    Hey Charles, did you come up with a solution for your problem?
  • quinta-feira, 26 de abril de 2012 20:32
     
     

    I apologize for the late answer....

    I did some more research after posting this question and tracked down the piece of code in SharePoint which was at the centre of the problems we were having and posted a more precise question about it here.  Unfortunately, it appears that custom fields derived from SPFieldUrl are specifically not filterable and not allowed to be so.

    We did find a solution eventually, although it was somewhat more specialized as we also had the requirement that the field be filterable on multiple values (e.g. "Show me all records where Last Name is Johnson, Johnston or Johnsson.")  We created a custom web part which connected upstream of the ListViewWebPart, which read the ListViewWebPart's configuration and modified it by adding a CAML filter query to it which satisfied the filter the user created in the new web part.