Child pages
  • Form Component

Versions Compared

Key

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

...

Code Block
languagejs
   function createContent() {
	   $element.empty();
	   var newValue = $scope.model.containedForm;
	   if (newValue) {
		   var elements = $scope.svyServoyapi.getFormComponentElements("containedForm", newValue);
		   var height = $scope.model.height;
		   var width = $scope.model.width;
		   // if the form of the form component is a absolute layout
		   // make sure to get the height and width from that form if our own height/widht are not set.
           // so that an absolute form is always inside a div that is generated below
		   if (newValue.absoluteLayout) {
			   if (!height) height = newValue.formHeight;
			   if (!width) width = newValue.formWidth;
		   }
		   if (height || width) {
			   var template = "<div style='position:relative;";
			   if (height) template += "height:" +height + "px;"
			   if (width) template += "width:" +width + "px;"
			   template += "'";
			   if ($scope.model.styleClass)  template += " class='" +$scope.model.styleClass + "'";
			   template += "></div>";
			   var div = $compile(template)($scope);
			   div.append(elements);
			   $element.append(div);
		   }
		   else $element.append(elements);
	   }
	   else {
		   $element.html("<div>FormComponentContainer, select a form</div>");
	   }
   }