ForgeKomponenter
sv

Komponenter

j-NotificationsPanel

jComponent 20 · jcomponent@20 component Exempel laddat med jComponent 20
  • singlar
  • Lär dig från exemplet

Konfigurera:

  • top {Number} topp offset (default: 0)
  • visibleY {Boolean} visar Y skruvbar (default: true)
  • title {String} titel i meddelanden panel (default: Notifications)
  • autoremove {Boolean} tar bort anmälningar efter att ha klickat på den (default: true)
  • click {String} en väg till metoden function(obj, el) när användaren klickar på anmälningarna
  • exec {String} en väg till metoden function(render(ARR_OF_OBJECT)) när användaren vill visa anmälningarna

Använd den med <ui-component name="notificationspanel">När komponenten ännu inte är laddad, jComponent Ladda ner den första gången från adressen i DEF.fallback (en av Componentator Författare: Peter Širka. källa: The Componentator Komponenterna i lager, MIT licens.

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>