Forums de discussion

AUI

bcc bcc, modifié il y a 9 années.

AUI

New Member Publications: 16 Date d'inscription: 20/03/14 Publications récentes
Hi!
I have two questions:
1. The difference between the AUI.add and AUI.use?



2.
Why alert (123); does not work?

js

AUI.add(
		'testAtest',
		function(A){
			var Lang = A.Lang;
			var qWERT = A.Component.create(
					{
						ATTRS: {
							test: {
								value: null
							}
						},
						prototype: {
							initializer: function() {
								var instance = this;
								instance.renderUI();
							},
							renderUI: function() {
								var instance = this;
								var previewURL = instance.get('test');
								alert(123);
							},
						}
					}
			);
			Liferay.qWERT = qWERT;
		},
		'',
	{
		requires: ['aui-base']
	}
);


and

jsp

<aui:script use="testAtest">
			var qWERT = new Liferay.qWERT(
				{
					test: 'qwerty'
				}
			
			);
</aui:script>
thumbnail
Iliyan Peychev, modifié il y a 9 années.

RE: AUI

New Member Publications: 19 Date d'inscription: 17/11/10 Publications récentes
1. AUI.add adds a module, with use you use it.
2. renderUI method is part of Component lifecycle so you have to render the component and AlloyUI will invoke this method. Just do:
qWERT.render();
in your JSP.