ForgeComponents
en

Components

j-ListMenu

jComponent 20 · jcomponent@20 component Example loaded with jComponent 20

A ListMenu component for custom list items. You need to style it.

Configuration:

  • class {String} CSS class for selected item (default: selected)
  • selector {String} jQuery selector for scope of rendered item (default: a)
  • datasource {String} data-source path (Array)
  • property {String} Property name for comparing of values (default: id)
  • click {Boolean} enables clicking on items (default: true)

Use it with <ui-component name="listmenu">. When the component is not loaded yet, jComponent downloads it on first use from the address in DEF.fallback (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.

example.html
<ui-component name="listmenu" path="listmenu.selected" config="datasource:listmenu.datasource" class="listmenu">
	<script type="text/html">
		{{ if id && id !== '-' }}
			<a href="#">{{ name }}</a>
		{{ else }}
			<hr />
		{{ fi }}
	</script>
</ui-component>

<script>

	var listmenu = {};

	// Default selected item
	listmenu.selected = 4;

	// Data-Source
	listmenu.datasource = [];
	listmenu.datasource.push({ id: 1, name: 'List Item 1' });
	listmenu.datasource.push({ id: '-' });
	listmenu.datasource.push({ id: 2, name: 'List Item 2' });
	listmenu.datasource.push({ id: 3, name: 'List Item 3' });
	listmenu.datasource.push({ id: 4, name: 'List Item 4' });
	listmenu.datasource.push({ id: 5, name: 'List Item 5' });
	listmenu.datasource.push({});
	listmenu.datasource.push({ id: 6, name: 'List Item 6' });
	listmenu.datasource.push({});
	listmenu.datasource.push({ id: 7, name: 'List Item 7' });
	listmenu.datasource.push({ id: 8, name: 'List Item 8' });
	listmenu.datasource.push({ id: 9, name: 'List Item 9' });
	listmenu.datasource.push({ id: 0, name: 'List Item 0' });

</script>