Creating a New Control Factory

Previous Next

To create a new control factory and make it known by the application, use the method mentioned above. The name given as the first parameter must be unique, and match the 'XML Tag Name' property for that control in the Web Designer. The factory inherits all the functionality of the factory mentioned in the second parameter. For the third parameter pass an object that overrides those parts that must be altered.

It is possible to call functionality from the superclass. The this variable in functions of a factory always refer to the factory object and has a member super.

$.udb.ui.registerControl("MyButtonControl", "ButtonControl", {
 render: function($target, propsChild, master) {
         var $el = this.super.render.call(this, $target, propsChild, master);
         
 }
});

 

To use this button in your application, you must change the 'XML Tag Name' property to the value 'MyButtonControl' in the Web Designer, and it will use this new factory instead of the default 'ButtonControl' factory.