5 Replies Latest reply on Dec 29, 2017 8:29 PM by fmanniti 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 Heavyweight Champ

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

        • Re: Creating a widget, can't bind my properties
          vxavier Explorer

          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?

          • Re: Creating a widget, can't bind my properties
            stevegr Creator

            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