Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can set value as Indeterminate #12

Open
CeloHill opened this issue Feb 5, 2022 · 1 comment
Open

Can set value as Indeterminate #12

CeloHill opened this issue Feb 5, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@CeloHill
Copy link

CeloHill commented Feb 5, 2022

Hi,
I'm using the progress-circle multiple times in a page.
Do do so I set the value in data tag as <div class="nota-analise big circulo" data-score="9">
When I call my javascript it is called looking for that value. It don't work when their's no score set.

my javascript.
var notas = cj('.nota-analise').all();
notas.forEach(function(nota){ var score = cj(nota).attr('data-score'); new CircleProgress(nota, { max: 1, max: 10, value: score, textFormat: 'value', indeterminateText: '--' }); });

doesn't matter what I set in value (null, undefined), it never set as indeterminated.
Can you help me?

@tigrr
Copy link
Owner

tigrr commented Feb 7, 2022

Hello,
Circle Progress replicates the behavior of the native progress element. The progress element cannot be reverted to indeterminate state by means of setting a property, but only by removing the "value" attribute.
In Circle Progress there are of course no attributes as it is not an HTML element. Thus for now there is no way to set the state to indeterminate once a value has been assigned.
I think the feature you are requesting is needed. However, in your use case, if I understand it correctly, you are only setting the value once at the initiation. So, you can simply skip the value property, like so:

var notas = cj('.nota-analise').all();
notas.forEach(function(nota){
    var score = cj(nota).attr('data-score');
    var options = { max: 1, max: 10, textFormat: 'value', indeterminateText: '--' }
    if (score) {
        options.value = score;
    }
    new CircleProgress(nota, options);
});

@tigrr tigrr closed this as completed Feb 7, 2022
@tigrr tigrr reopened this Feb 7, 2022
@tigrr tigrr added the enhancement New feature or request label Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants