Friday, 12 January 2018

SPARK UI Custom Control

Another approach for creating custom control on SPARK UI controls :

Example : Add minimum and maximum value that an integer control can restrict the user to enter to.

1. Copy Integer control from BPM UI to your Process App or toolkit and rename it .

2. Add minValue and maxValue variables under configuration options
3. Add the custom JS functions and attach the necessary event to the node after the instantiation of the control

bpmext_control_InitDecimal.call(this, bpmext, utilities, domClass, domAttr, domConstruct, false, i18n, numberHelper, null);

//fetch the min value and max value
 var minValue = this.context.options.....

//dynamically fetch the element id
 if(element != undefined){
     var id = element.id;
 }






//After the dom is ready attach the neccessary eventhandler ,in this case keypress
require(["dojo/ready", "dojo/dom", "dojo/query", "dojo/keys","dojo/parser", "dijit/form/Button"],
function(ready, dom,query,keys){
      ready(80, function(){
               query("input[id*="+id+"]").on("keypress", function(event) {
                    return true or false
            }
          });
      });
});