Foros de discusión

How to dynamically display "Loading..." messge in A.Plugin.io

thumbnail
Muthukumar Thangavinayagam, modificado hace 9 años.

How to dynamically display "Loading..." messge in A.Plugin.io

New Member Mensajes: 22 Fecha de incorporación: 16/12/10 Mensajes recientes
Hi All,
In my portlet while calling ajax call using A.Plugin.io alloy UI ,By default showing A.Plugin.io class display "Loading..." from aui-loading-mask.js file. In aui-loading-mask.js file the message was hardcoded. How to show in "Loading..." message dynamically. Please find the below code snippet was using in my portlet.

noadeContent.plug(A.Plugin.IO, {
uri : uri,
//autoLoad: false,
on: {
start: function(){
//alert("Hi");
() },loadingMask: {
strings: {
loading: 'Saving…'
}
}
}
});
But above code not working still it showing the "Loading..." message , How to use "loadingMask" to overwrite the default "Loading..." content ?

Thanks,
Muthukumar Thangavinayagam.
thumbnail
Tanweer Ahmed ., modificado hace 1 año.

RE: How to dynamically display "Loading..." messge in A.Plugin.io

Expert Mensajes: 322 Fecha de incorporación: 11/03/10 Mensajes recientes
Hi Muthukumar,

I did the same thing in the below way.May be this helps you.
<aui:script>
	
	Liferay.provide(window, 'updateInfo', function() {
		
		var A = AUI();
		var userName = A.one('#<portlet:namespace />userName').get('value');

		var loadingMask = new A.LoadingMask({
			'strings.loading' : 'This is my custom loading message',
			target : A.getBody()
		});
		
		loadingMask.show();

		A.io.request(
				'&lt;%= resourceURL.toString() %&gt;',
				{
					data :{
						userName: userName
					},
					on: {
						failure: function() {
							loadingMask.hide();
                            var message = this.get('responseData');
                            alert("Ajax Error : "+message);
                         },
		                success: function(event, id, obj) {
		                	loadingMask.hide();
                            var message = this.get('responseData');
                            alert("Ajax Success : "+message);
                         }
					}
				}
			);
	}, ['aui-io-request','aui-loading-mask-deprecated']);
	
</aui:script>

-Tanweer