cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Creating a widget, can't bind my properties

fmanniti
10-Marble

Creating a widget, can't bind my properties

I'm creating a widget for my very first time.

My widget is quite similar to "Gradient meter" present in marketplace, with a difference: Gradient meter indicates the percentage of your property, I want its exactly value number compared with the scale.

It means that at the bottom I will have my minimum value (instead of 0%) and on my top I will have my maximum value (instead of 100%).

This leads to a main difference with Gradient meter: minimum and maximum values should be two input properties and therefore "bidingble" .

What I've done is write this code into my ide.js file

'Value': {

     'description': 'Data value',

     'isBindingTarget': true,

     'baseType': 'NUMBER',

     'defaultValue': 0,

     'warnIfNotBoundAsTarget': true

},

'MinValue': {

     'description': 'Minimum value for the scale',

     'isBindingTarget': true,

     'baseType': 'NUMBER',

     'defaultValue': 0

},

'MaxValue': {

     'description': 'Maximum value for the scale',

     'isBindingTarget': true,

     'baseType': 'NUMBER',

     'defaultValue': 150

},

What happens is that on my mashup I can drag and drop my property into "Value" and it actually works, but if I do the same with MinValue and MaxValue I will still "see" 0 and 150. Unless I don't change them by hand, so not by binding but from here

now, can you tell me if is there anything else I should do to bind my properties with values in my code side? Or, maybe, you need to see a bigger part of my code. I have no problem in showing it

5 REPLIES 5

You should write code on runtime.js also in order to get this MinValue and MaxValue and set your widget on runtime accordingly.

If you reused the widget, look at what does the Widget on runtime.js for handling "Value" property binding changes.

By the way, I don't know if it's the case of Gradient Widget, but on the Gauge Widget you can bind minimum and maximum values ( look at that code for instance ).

vxavier
14-Alexandrite
(To:fmanniti)

Good Afternoon Fabio,

I am having the same issue. The properties that are typed STRING I can update easily with binding. But properties that are INTEGER I am with the same problem. It doesn't update. The insert cell don't turn in green with binding. And when I try to delete the default numeric value and just let the bind it says that the entry is not a numeric value.

Did you solved this?

Vincius,

The message "is not numeric" is a good sign as an empty value is not an integer. So the binding is correct

Can you supply what you are doing in the runtime

vxavier
14-Alexandrite
(To:sgreywilson)

Hi Steve, Thank you for you suport,

I already solve this problem. I solve it by change default value to 0. Then it recognize everything right. Before it was 1 and the binding was not working.

The "Is not numeric" message I think it was because it was seeing blank like an empty string.

Fabio,


I see you are using


'isBindingTarget': true        


in your ide. Can you show (as also mentioned by Charles) what you are doing in the runtime code.


Your should be doing something like


var minValue =this.getProperty("MinValue");

var maxValue =this.getProperty("MaxValue");


to get the values into the runtime code

Announcements


Top Tags