Dynamic List Content: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
(Created page with "As of XBMC Gotham, container controls (the List Container, Fixed List Container, Wrap List Container, and Panel Container) can be setup by the skinner with dyn...")
 
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
As of XBMC Gotham, container controls (the [[List Container]], [[Fixed List Container]], [[Wrap List Container]], and [[Panel Container]]) can be setup by the skinner with dynamic content from a path or plugin. This is done by including the <content> tag in the control. It saves many lines of code as it's not necessary anymore to use static items for i.e. recently added movies.
<section begin="main content" />
Container controls (the [[List Container]], [[Fixed List Container]], [[Wrap List Container]], and [[Panel Container]]) can be setup by the skinner with dynamic content from a path or plugin. This is done by including the <content> tag in the control. It saves many lines of code as it's not necessary anymore to use static items for i.e. recently added movies.


=== Examples ===
=== Examples ===
Line 6: Line 7:
<content>plugin://plugin.test.me?arg1=foo</content>
<content>plugin://plugin.test.me?arg1=foo</content>
</syntaxhighlight>
</syntaxhighlight>


Content filled from a path
Content filled from a path
<syntaxhighlight lang="XML" enclose="div">
<syntaxhighlight lang="XML" enclose="div">
<content target="music">musicdb://recentlyaddedalbums/</content>
<content target="music" sortby="artist" sortorder="ascending" limit="10">musicdb://recentlyaddedalbums/</content>
</syntaxhighlight>
</syntaxhighlight>


It's also possible to fill a container with multiple <content> sources.


=== Available attributes ===
=== Available attributes ===
Line 21: Line 24:
|  '''target'''
|  '''target'''
|  Specifies the context window of the content. This is only necessary for folder items as it defines which window should be activated. For example '''musicdb://albums/''' should have '''target="music"''' but '''musicdb://songs/''' does not need a target because it contains only songs which will be played via '''PlayMedia(...)''' rather than opened via '''ActivateWindow(target,path,return)'''
|  Specifies the context window of the content. This is only necessary for folder items as it defines which window should be activated. For example '''musicdb://albums/''' should have '''target="music"''' but '''musicdb://songs/''' does not need a target because it contains only songs which will be played via '''PlayMedia(...)''' rather than opened via '''ActivateWindow(target,path,return)'''
|-
|  '''limit'''
|  Limits the number of items in the container.
|-
|  '''sortby'''
|  Sorts the list by the given value.
|-
|  '''sortorder'''
|  Sort direction of the list: ascending or descending.
|-
|  '''browse'''
|  Since v21: Control visibility of the "more..." button which can be appended to lists to open the window specified by the '''target''' attribute:
* '''always''' : Add the button, if list contains at least one item.
* '''auto''' : Add the button, if the list as provided by the core actually has more items than specified by the '''limit''' attribute. This is the default value.
* '''never''' : Never add the button.
|}
|}


 
=== Available item properties (can be filled in plugins) ===
=== Item properties (can be filled in plugins) ===
{| class="prettytable"
{| class="prettytable"
! Item properties !! Description
! Property !! Description
|-  
|-  
|  '''node.target'''
|  '''node.target'''
Line 35: Line 52:
|}
|}


=== Override onclick action ===
You can define a custom <onclick> action for lists with dynamic content.
<syntaxhighlight lang="XML" enclose="div">
<control type="list">
    ...
    <onclick>some_builtin</onclick>
    ...
    <content>...</content>
</control>
</syntaxhighlight>


<section end="main content" />
== See also ==
== See also ==
'''Development:'''
'''Development:'''

Latest revision as of 05:46, 30 September 2023

Container controls (the List Container, Fixed List Container, Wrap List Container, and Panel Container) can be setup by the skinner with dynamic content from a path or plugin. This is done by including the <content> tag in the control. It saves many lines of code as it's not necessary anymore to use static items for i.e. recently added movies.

Examples

Content filled from a plugin

<content>plugin://plugin.test.me?arg1=foo</content>


Content filled from a path

<content target="music" sortby="artist" sortorder="ascending" limit="10">musicdb://recentlyaddedalbums/</content>

It's also possible to fill a container with multiple <content> sources.

Available attributes

The available XML attributes for the content tag are as follows. Note that, as always, they're lower-case only, as XML is case-sensitive.

Attributes Description
target Specifies the context window of the content. This is only necessary for folder items as it defines which window should be activated. For example musicdb://albums/ should have target="music" but musicdb://songs/ does not need a target because it contains only songs which will be played via PlayMedia(...) rather than opened via ActivateWindow(target,path,return)
limit Limits the number of items in the container.
sortby Sorts the list by the given value.
sortorder Sort direction of the list: ascending or descending.
browse Since v21: Control visibility of the "more..." button which can be appended to lists to open the window specified by the target attribute:
  • always : Add the button, if list contains at least one item.
  • auto : Add the button, if the list as provided by the core actually has more items than specified by the limit attribute. This is the default value.
  • never : Never add the button.

Available item properties (can be filled in plugins)

Property Description
node.target Specifies the context window of the content. This overwrites the target attribute of the content tag.
node.target_url Overwrites the path of an item if it's clicked on. This can be used to show the content of the item's path in another container while entering a different path if the item is clicked on. An example would be Confluence's home screen where Movies shows the items of it's path as a submenu below while clicking the item always takes the user to movie titles.

Override onclick action

You can define a custom <onclick> action for lists with dynamic content.

<control type="list">
    ...
    <onclick>some_builtin</onclick>
    ...
    <content>...</content>
</control>


See also

Development: