LibScroll
What does it do?
It handles the basic code for creating a scrollList & updating the scrollList data for you.

How do I create a scrollList with it?
I will give a full example at the end of this post, first lets look at the individual pieces of code you need.

At the top of your code file load the library:
Lua Code:
  1. local libScroll = LibStub:GetLibrary("LibScroll")

You will need to create a table containing the necessary information for initializing your scrollList. Below is an example containing all possible information you may include. Only the name, parent, & setupCallback are necessary, the rest are optional.

ScrollData table:
Warning: Spoiler


Explanation of table items:
Warning: Spoiler


Create your table of dataItems to be loaded into the scrollList:
You do not have to use "name" the tables can contain any data you want.
categoryId is optional, it is used to group items together in categories so you can show/hide items by showing/hiding categories.
Lua Code:
  1. local dataItems = {
  2.     [1] = {name = "first"},
  3.     [2] = {name = "second", categoryId = 2},
  4.     [3] = {name = "third", categoryId = 2},
  5.     [4] = {name = "fourth", categoryId = 2},
  6.     [5] = {name = "fifth", categoryId = 3},
  7.     [6] = {name = "sixth", categoryId = 3},
  8.     [7] = {name = "seventh", categoryId = 7},
  9.     [8] = {name = "eigth", categoryId = 8},
  10.     [9] = {name = "nineth", categoryId = 9},
  11. }

Then just call Update and pass in your table:
Lua Code:
  1. scrollList:Update(dataItems)

Available Functions:
scrollList:Clear() -- Clears all data from the scrollList
scrollList:Update (table dataItems) -- Pass in a table containing all of your data items for the scrollList to update the list with new data.
** Do note for the show/hide category functions to work the category values must be assigned to the scrollList by including them in the scrollData table that you pass to libScroll:CreateScrollList(scrollData) **
** Also these will only effect data items that have a categoryId assigned to them. As an example if you did not assign a categoryId to a data item & call HideAllCategories it will not be hidden **

scrollList:ShowAllCategories() -- Shows all data items that have a categoryId that matches one of the categories assigned to the scrollList. Data items without a categoryId will not be effected.
scrollList:ShowOnlyCategory(integer categoryId) -- Shows only data items that have the given categoryId, all other data items are hidden (if they have a categoryId, items without a categoryId will not be effected).
scrollList:ShowCategory(integer categoryId) -- Shows data items that have the given categoryId.
scrollList:HideAllCategories() -- Hides all data items that have a categoryId that matches one of the categories assigned to the scrollList. Data items without a categoryId will not be effected.
scrollList:HideCategory(integer categoryId) -- Hides data items that have the given categoryId.


A Complete (simple) example for creating a scrollList, no highlights, no select callbacks, & no sorting:
Warning: Spoiler


A Complete example with selection callbacks, row highlights, & a sorting function:
Warning: Spoiler