Tabulate Listviews (demo)
Many people on the forum are looking to handle long lists of data, usually with code information, e.g. AB-1025, and wanting to select from a list. A single column list can become unwieldy, therefore I decided to have a look at using multiple listviews to display the data, both for a column down, e.g. Column 1 -1 to 20, Column 2 – 21 to 40, and also for column across, e.g. Column 1 – 1,4,7 Column 2 – 2,5,8 Column 3 – 3,6,9 and so on. I also wanted to provide the functionality to sort the data, but have the option to use the unsorted original list if preferred. Finally, a selection from any of the listviews should return the selection and its index in the original list.
I worked to make the demo as dynamic as possible, that is it should work for any number of listviews, any length of list. Because there are currently no “any component” event blocks, this is not completely possible, therefore to change the number of listviews will require some modification to the blocks – specifically the initial list of all the list views, and the afterpicking events used to highlight the selection. Other than that everything should work dynamically.
On load, the app requires the user to load the data from the csv file in assets, using the Fetch Data button. This will then populate the list views with the data, sorted to the original sort order, and displaying in the column down view. The user can then change the sort order and the column view by clicking the respective buttons. Any change to the sort order will reset the column view to down.
When the user selects an item in the list, two clocks come into play, the first is always running, checking if a selection on any of the listviews has been made, and if so to show the selection and index in the labels at the bottom of the screen. The second clock will momentarily highlight the selected item