Child pages
  • Inheritance Model

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Setting a super form

On an existing form, you can set the super form can be set by going to the properties and setting the "extends" property to the super form.

If you want to To do this in runtime, you can use the solution model it can be done using the same property with the solutionModel.

Sample method:

Code Block
function extending() {
	var _jsForm = solutionModel.getForm('formC')
	_jsForm.extendsForm = solutionModel.getForm('formB')
}

All the elements on the form are accessible in the solutionModel also the elements that are inherited from a other form they can be accessed as if they are on the sub form.

Overwrite methods

On the child A sub form you will inherit all the methods of the super form. You can overwrite these methodsThese methods can be overwritten. When you do this happens, Servoy will generate a method for you with a call to it's super in it.

In the generated method you there will see be '_super.newRecord(event)' this will call the original method on the super form. You This can remove this if you donbe removed if the super code doesn't want to call this method be called or you can put code before of after the call, if you put it after don't forget to move the 'return'.

...

There are not many limitations to form inheritance. One of the limitations is that if you have there is an element on the super form, you it can not delete it be deleted on the child sub form, if you don't want to see it on your child form you can uncheck the it should not show on the sub form the visible property of the element can be unchecked. Another limitation is that you there cannot insert be new parts inparts added in-between existing ones, new parts can only be added below existing parts.

...

The security of a form that is extended works like it would work if it was not extended, you security can be set security on all the elements you see on the form, even if they are inherited. You have The security has to be set the security on the form that the user uses and not on one of the super forms. In the security tab you will see from which form the elements it is shown from what form the inherited elements are inherited.