EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Juan Antonio Martínez on January 13, 2017, 01:52:02 AM



Title: Remove percent sign in progressbar
Post by: Juan Antonio Martínez on January 13, 2017, 01:52:02 AM
Hi all,
Is there any way to remove percent sign '%' from progress bar in $.messager.progress , to provide own messages?

Using jeasyui-1.4.2 ( too old, I know, but have some old plugins and... )

Thanks in advance
Juan Antonio


Title: Re: Remove percent sign in progressbar
Post by: stworthy on January 13, 2017, 04:35:42 AM
Please use this code to custom the text value on progress bar.
Code:
$.messager.progress({
title:'Please waiting',
msg:'Loading data...'
});
var bar = $.messager.progress('bar');
bar.progressbar({
text: 'custom value:{value}'
});


Title: Re: Remove percent sign in progressbar
Post by: Juan Antonio Martínez on January 13, 2017, 06:26:55 AM
Works like a charm.
Thanks

BTW, perhaps it could be usefull to improve $.messager.progress by providing a method to ask progress to server and retrieve (and show) response into progress bar

Something like:

Code:
                $.messager.progress({
                    title: '<?php _e("Downloading");?>',
                    msg: '<?php _e("Downloading new version into server");?>: '+name+'-'+release,
                    interval: 2000, // ask server for progress every 2 seconds
                    callback: progressMonitor
                });
....
                function progressMonitor(){
                    $.ajax({
                        url:"/agility/server/adminFunctions.php",
                        dataType:'json',
                        data: {
                            Operation: 'progress',
                            Suffix: suffix
                        },
                        success: function(data) {
                            var value=data.progress;
                            if(value!=="Done"){
                                var bar=$.messager.progress('bar');
                                bar.progressbar('setValue', value);  // set new progress value
                                // setTimeout(progressMonitor,2000);
                            } else {
                                $.messager.progress('close');
                            }
                        }
                    });
                }