[jQuery Knob] Format Causes Issues with Ouput

[jQuery Knob] Format Causes Issues with Ouput

Forge Component
Published on 2016-06-13 by Rafael Fantato
2 votes
Published on 2016-06-13 by Rafael Fantato

I've been a fan of jQuery Knob forever it seems...but it appears there is still a challenge when it comes to the formatting function.  I of course do not know how to actually fix the issue because my coding skills are meh, but I do know how to work around certain things!  

Use Case:

User wants to display a percentage in the dial and use the updated value to do something.  The source information is in type int or decimal.

Issue:  When using a variable type of Int or Decimal in conjunction with the 'format' function, the output result will be 0.  Without using the 'format' function, the suffix is not displayed in the dial.


I have attempted to "fix" the code around the 'format' function and the return value to no avail.  The underlying js converts this to a string so when the input value returns it's not recognized by OS as a numerical value.

The best workaround I have thus far is:

1) Add an additional hidden placeholder for an input box in the knob webblock

2) In the 'release" function within the script call, add the line $('#"+ hiddenblock.id+" input).val(value);

3) In the screen where the dials are being used, use an initial and changed variable; read from the changed variable

I have a screen with dozens of knobs and have built built a structure around this to cut down on the variable bloat.


I'm looking for anyone who knows how to actually fix this within the component code itself without breaking the core functionality of the dial.  Thanks in advance!