Container.SetSortMethod - Printable Version
+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Development (/forumdisplay.php?fid=32)
+--- Forum: Skin Development (/forumdisplay.php?fid=12)
+--- Thread: Container.SetSortMethod (/showthread.php?tid=103113)
Container.SetSortMethod - Jeroen - 2011-06-08 16:23
So, I have a button in MyVideoNav.xml. I want that button to show up in one specific viewtype. No problem. But when clicked I want that button to set the sortmethod to a specific type, like year or name.
The wiki states:
Quote:Container.SetSortMethod: Change to the specified sort method.
But how do I actually specify the sortmethod? I though it was by:
But that doesn't work. I tried several other things, but none of them do anything.
I've got a feeling it's probably really obvious but I can't figure it out
- Hitcher - 2011-06-08 17:36
Container.SetSortMethod(n) with the number being the sort method you want from the list below.
Found in the SortFileItem.h
- pieh - 2011-06-08 17:43
Just to get You started: You'll need to take a look here. There You have highlighted list of all available sort methods in XBMC. Now You have to get integer "id" of sort method You want: (SORT_METHOD_NONE=0, SORT_METHOD_LABEL=1, SORT_METHOD_LABEL_IGNORE_THE=2, ..., just add +1 for every next one). And use that id with Container.SetSortMethod(id).
Container.SetSortMethod(24) will set sorting to titles (in video section) (SORT_METHOD_VIDEO_SORT_TITLE)
Container.SetSortMethod(18) will set sorting to raiting (SORT_METHOD_VIDEO_RATING)
Not every sort method is available in each view, so You'll have to experiment a little.
There are some sorts with _IGNORE_THE appended - xbmc automaticly switch to them if user set Ignore articles when sorting (e.g. "the") in settings -> appearance -> file lists.
damn, Hitcher was first ;P
- Jeroen - 2011-06-08 18:01
Thank you both, that's excellent information
Yeah I noticed already that not all methods are available. Is that because this is still being worked on? Because I would really like to sort on genre, but that one doesn't seem to be working.
What I'm out for is basically creating a column based listview where one is able change the sorting from within the view itself by faux selecting the columns (think along the lines of Kaleidescape)
Cheers guys, great help