Smallest interval/increment for Client ProgressBar

UI Components for JSF
Post Reply
PogoMips
Posts: 2
Joined: 26 Nov 2015, 14:26

26 Nov 2015, 14:36

I'm having some trouble with the Client ProgressBar regarding the interval.

When I use the showcase example with an 1s interval and an increment of 10 [pbClient.setValue(pbClient.getValue() + 10);] everything runs fine and the bar runs for 10s as expected.

However, if I change the interval to 0.1s and the increment to 1 [pbClient.setValue(pbClient.getValue() + 1);] it runs far longer than 10 seconds. at least 40 or 50 seconds.

It seems like there's a minimum animation time between each step that cannot be undershot.

Anybody know hot to fix this?

ciaporte
Posts: 7
Joined: 28 May 2015, 20:35

30 Sep 2016, 18:42

I have a similar problem, I'm using to show the progress of a download, but just the download is a little fast and progressbar delay to update the progress, the result is that when the download is complete the progress still came in half.
This is why they are using animation to update progress, this animation is 500ms, so each progress update takes all this time.
I think the ideal solution would be to create an attribute to allow changing the delay of the animation.

Now:

Code: Select all

    
    setValue: function(value) {
        if(value >= 0 && value<=100) {
            if(value == 0) {
                this.jqValue.hide().css('width', '0%').removeClass('ui-corner-right');

                this.jqLabel.hide();
            }
            else {
                this.jqValue.show().animate({
                    'width': value + '%' 
                }, 500, 'easeInOutCirc');

                if(this.cfg.labelTemplate) {
                    var formattedLabel = this.cfg.labelTemplate.replace(/{value}/gi, value);

                    this.jqLabel.html(formattedLabel).show();
                }
            }

            this.value = value;
            this.jq.attr('aria-valuenow', value);
        }
    },

Ideal:

Code: Select all

    
    setValue: function(value) {
        if(value >= 0 && value<=100) {
            if(value == 0) {
                this.jqValue.hide().css('width', '0%').removeClass('ui-corner-right');

                this.jqLabel.hide();
            }
            else {
                if (this.cfg.animationDelay > 0) {
                    this.jqValue.show().animate({
                        'width': value + '%' 
                    }, this.cfg.animationDelay, 'easeInOutCirc');
                } else { 
                   // allow disable animation
                    this.jqValue.show().css('width', value + '%');
                }

                if(this.cfg.labelTemplate) {
                    var formattedLabel = this.cfg.labelTemplate.replace(/{value}/gi, value);

                    this.jqLabel.html(formattedLabel).show();
                }
            }

            this.value = value;
            this.jq.attr('aria-valuenow', value);
        }
    },

User avatar
andyba
Expert Member
Posts: 2473
Joined: 31 Mar 2011, 16:27
Location: Steinfeld, near Bremen/Osnabrück, DE
Contact:

05 Oct 2016, 12:06

I have to ask this, why are you duplicating something browsers already offer?
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now

Waldgeist
Posts: 2
Joined: 13 Aug 2014, 11:48

19 Jul 2017, 12:06

Yes, I have the same problem and a "overshooting" progressbar (PF 6.1)

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

20 Jul 2017, 10:17

Cool and?

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 41 guests