Versions Compared

Key

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

...

Method

Parameters

Description

apply

propertyName

the name of the property of type dataprovider

Pushes a changed dataprovider value of the component to the server.

It is used by the svy-autoapply directive, but it can also be used directly by the webcomponent.

For example the radio button pushes the new value to the server when the radio is clicked:

Code Block
languagejs
titleradio.js
$scope.radioClicked = function()
{
	$scope.model.dataProviderID = $scope.model.valuelistID[0].realValue;
	$scope.svyServoyapi.apply('dataProviderID')
}

callServerSideApi

methodName

the name of the serverside method to call

args

the arguments of the serverside method

Used on the client side to call a function which is defined in the server side api of the component.

It returns a promise of angular where the then function will give you the return value of the callback.

Code Block
languagejs
titlecomponent_server.js
$scope.mycallback = function(name,type) 
{
    return "something";
}

In the controller or link function of the component, "mycallback" can be invoked via

callServerSideApi:

Code Block
languagejs
titlecomponent.js
 $scope.servoyApi.callServerSideApi("mycallback",["string",1])
.then(function(retValue) {
   console.log(retValue);   
 });

formWillShow

formname

– the name of the form which will be shown

relationname

– the name of the relation (optional)

formIndex

– the formIndex in the tabpanel (optional)

Prepare the form for showing. Example switching tabs in the tabpanel component:

Code Block
languagejs
titletabpanel.js
function setFormVisible(tab,event) 
{
	if (tab.containsFormId) $scope.svyServoyapi.formWillShow(tab.containsFormId,
       tab.relationName);

hideForm

formname

– the name of the form to hide

relationname

the name of the relation (optional)

formIndex

the formIndex in the tabpanel (optional)

Hides the form. The outcome of the returned angular promise is a boolean, which is true if the form was hidden.

Used by the tabpanel to hide the previously selected tab.

Code Block
languagejs
titletabpanel.js
$scope.select = function(tab) 
{
    if (tab && tab.containedForm && !tab.active)
    {
		//first hide the previous form
		var promise =  $scope.svyServoyapi.hideForm( 
			$scope.model.tabs[$scope.model.tabIndex -1]);
		promise.then(function(ok) 
		{
			$scope.model.tabIndex = getTabIndex(tab)+1;
			//show the selected form
			$scope.svyServoyapi.formWillShow(			   
            tab.containedForm, tab.relationName);
    	    tab.active = true;
		})    		  
   	}	  
}

getFormUrl

formName

Return the URL of a form. It can be used together with ng-include to include a

form in the component template:

Code Block
languagexml
titlecomponent.html
<div ng-include="svyServoyapi.getFormUrl(myFormName)" ></div>

startEdit

propertyName

the name of the property which is edited

Signal that the editing of a property has started, usually at focus gained.

It is needed automatically used by the svy-autoapply directive.

As an example, in the child component property type (for instance in portals) it is used to mark

that the editing of that cell has started:

Code Block
languagejs
titlecomponent.js
/** rowId is only needed if the component is linked to a foundset */
startEdit: function(property, rowId) 
{
	var req = { svyStartEdit: {} };
	if (rowId) 
	{
     req.svyStartEdit[$foundsetTypeConstants.ROW_ID_COL_KEY] = rowId;
	}
	req.svyStartEdit[PROPERTY_NAME_KEY] = property;
	internalState.requests.push(req);
}

In the code above, the rowId argument is required to specify which record is in the edit mode.