0

I have a web part page displaying four “provider” web parts, each containing the Title column from one of four lists: Efforts, Phases, CapturePoints, Functions.

These lists are lookup sources for lookup columns (Effort, Phase, CapturePoint, Function) in my consumer list.

In a fashion similar to using connected web parts, I had a requirement to be able to click a value in one of the four provider web parts, and filter the list view in a fifth (consumer) web part to the value that was clicked. I have this working with a little bit of javascript/jquery and am quite happy with it.

Now, though, I have a further requirement: In the provider web parts, display the number of items in the consumer list that contain the filter values in each of the provider web parts, next to the provider list view value.

So, it would look like this:

Efforts web part:

AAA (4)

BBB (17)

CCC (0)

...

Accordingly, the consumer list would display 4 items with Effort values of ‘AAA’, and so on.

After a lot of googling, I was able to come up with this list service call that tells me how many items have a given ‘Effort’ value:

[URL]/_vti_bin/listdata.svc/[consumer list]/$count?&$filter=Effort/Title eq ‘AAA’

Finally, the purpose of this question…

I’m struggling with figuring out how to string this all together in my script:

  • Iterate through all of the Title values
  • query the consumer list for the number of items with that value as the relevant lookup column
  • append that number to the value in the provider web part.

I just realized that I’ll have to modify my (working) script to make it ignore the string appended to the original value. Ugh!

I will be eternally grateful for any assistance.

1 Answer 1

1

What I ended up doing, was use a grouped view in my "provider" web parts. When you use a grouped view, SP will automatically append the number of items in the group to the group label. Then, I used jQuery to strip out everything but the group labels, and make them clickable and able to filter the "consumer" web part.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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