ForgeComponents
en

Components

j-NotificationsPanel

jComponent 20 · jcomponent@20 component Example loaded with jComponent 20
  • singleton
  • learn from the example

Configuration:

  • top {Number} top offset (default: 0)
  • visibleY {Boolean} shows Y scrollbars (default: true)
  • title {String} title in notifications panel (default: Notifications)
  • autoremove {Boolean} removes notifications after click on it (default: true)
  • click {String} a path to method function(obj, el) when the user clicks on the notifications
  • exec {String} a path to method function(render(ARR_OF_OBJECT)) when the user wants to show the notifications

Use it with <ui-component name="notificationspanel">. 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="notificationspanel" path="shownotifications" config="exec:loadnotifications;click:clicknotificiation">
	<script type="text/html">
		<h2>{{ name }}</h2>
		<p>{{ body }}</p>
		<hr />
	</script>
</ui-component>

<script>

	var shownotifications = false;

	// Shows notifications panel after 2 seconds
	SET('shownotifications', true, 2000);

	// The method will be executed automatically before the notifications panel will be visible
	function loadnotifications(render) {
		var arr = [];
		arr.push({ name: 'Name of notifications 1', body: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos, architecto!' });
		arr.push({ name: 'Name of notifications 2', body: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos, architecto!' });
		arr.push({ name: 'Name of notifications 3', body: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos, architecto!' });

		// IMPORTANT:
		// This renders notifications onto notifications panel
		render(arr);
	}

	function clicknotificiation(obj) {
		console.log('CLICK', obj);
	}

</script>