3

Ok, so I would normally take the time to write this, but don't have said time to do it at the moment. I need a web part for SharePoint 2010 that does something very simple: display list items from a SharePoint list one at a time in a random order.

It is going to be used to randomly display tips and tricks for users. Anyone have something that is freely available that would save me some development time? This is for SharePoint 2010. Thanks.

4 Answers 4

6

Here's an example of a content slider for SharePoint I made based on jQuery, https://www.nothingbutsharepoint.com/sites/eusp/pages/creating-your-own-content-slider-for-sharepoint.aspx.

6
  • Eric, took me about 20 minutes to use the solution (since we already had jQuery and jQuery Services on the master page) by putting it all in a CEWP. Works fantastically. :-) Thanks. Commented Nov 29, 2011 at 16:56
  • Great, glad you like it and that it's easy to use. Very easy to tweak and customize with the jqshowoff plugin options and stylesheet. Commented Nov 29, 2011 at 16:57
  • Indeed. Onlything I changed was I excluded the CSS file from the showoff plugin altogether. It messed with SharePoint's styles a lot. Commented Nov 29, 2011 at 16:58
  • Anyway to randomize it? Commented Nov 29, 2011 at 17:02
  • Not within jqshowoff, you'd have to do something with how the html is build within the jquery or apply a sort order on the CAML that gives it some randomness. My Marquee post uses a different technique that might be more random friendly, t.co/5xuiM2D9. Commented Nov 29, 2011 at 17:34
4

I've done this for my current project, minus the random order part (which is relatively easy to add). Here's the solution (by @PirateEric): https://www.nothingbutsharepoint.com/sites/eusp/Pages/Creating-your-own-Content-Slider-for-SharePoint.aspx

To get this working for your project, update the CAMLViewFields and CAMLQuery to match your requirements; use the U2U CAML Builder tool to build and test your query. Modify the JavaScript to fetch the fields you need and the CSS to get the look you want. It's all rather straightforward.

You can also use JavaScript to generate a random number to determine which tip you'd show. This will be the only custom coding you'd have to do.

Update: Sorry for mentioning the same site as PirateEric! It's his rotator code :) Was typing this at same time as the other answers.

1
  • No worries, still a great answer. Commented Nov 29, 2011 at 14:52
2

There's an image rotator in my SharePoint User Toolkit:

http://sp2010.pathtosharepoint.com/sharepoint-user-toolkit

You can choose random or sequential order. And just display the text if you don't need the images.

Note that I am going to release a new version soon, to include Chrome support.

1
  • Not exactly what I needed, but a very nice tool. Will keep this in mind for other projects. Thanks. Commented Nov 29, 2011 at 14:52
1

Got half a day? Could do it easily with Client Object Model. Get the ListItemCollection, use a randomiser that goes between 0 and the number of items in the list, and 'gets' the item at the index which is the random number, using a function that calls itself with setTimeout every so-many-seconds.

1
  • Indeed, was trying to save the half a day ;-) Commented Nov 29, 2011 at 14:53

Your Answer

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

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