1 Reply Latest reply on Jul 21, 2016 6:38 AM by carlesc RSS
    fmanniti Creator

    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

      • Re: Creating a widget, can't bind my properties
        carlesc Ninja

        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 ).