Execute Container.SetSortMethod automatically
#1
Thumbs Up 
I want that the songs of any album should be displayed in sorted order based on Track Number not Title.
For this In "MyMusicNav.xml" I have written :

<onload>Container.SetSortMethod(7)</onload>

but it does not work, since first time the Albums are going to be displayed and for Albums, sort by Track number is meaningless.

And upon clicking any album the songs are displayed which should be sorted by Track number but that time the <onload> even is not fired so Container.SetSortMethod(7) is not executed.

When I write same thing on click of a button then it sorts the songs based on Track number.
But I want to happen it automatically means I don't want to provide a button for this.
Reply
#2
Sort by track number is default sort method for albums. If it's different for you, go into one album, change it and it will be changed for all albums unless you've changed it manually for some other albums.
Image
Reply
#3
But I have to do it automatically, suppose some one is using my skin and I don't want to provide the sort button and want to present the songs in sorted order based on Track.

how can I do that?
Reply
#4
Then change it to track, everything will be changed to track... XBMC is smart enough to change it for all albums if you change it for one. You just need to follow one rule: always change the sort method on the same album.

What you want is possible but really unecessary imo. If you still want to have it, I will explain how.
Reply
#5
Please explain the how !!
Reply
#6
Add a button to the focusedlayout of every available view for Container.Content(songs):

PHP Code:
<control type="button">
    <
onfocus>Container.SetSortMethod(7)</onfocus>
    <
visible allowhiddenfocus="true">false</visible>
    <
enable>!StringCompare(Container.SortMethod,$LOCALIZE[554])</enable>
</
control

It should work but I'm not exactly sure... if the onfocus action still gets executed every time you move in list, you can add condition="!StringCompare(Container.SortMethod,$LOCALIZE[554])" to the onfocus action.
Image
Reply
#7
Thanks Black, I will try .
Reply
#8
Question: Is there a technical reason we don't have <onfocus> for listitems?

It might be a nice feature to request.
Image [RELEASE] Metroid
Image [RELEASE] IrcChat
Reply

Logout Mark Read Team Forum Stats Members Help
Execute Container.SetSortMethod automatically0