Tips & Tricks - JavaScript in view tables

In a view table, clicking on a button displays the data record ID in a message. This article shows how such a message can be displayed using JavaScript.

Open the properties of the table column and define the Velocity part as the value of an expert attribute. Its name should begin with "data-" and be followed by lower-case letters only, for example. In our example, we enter the value

            $drRecord.getRecId()
        

In the JavaScript call, the Velocity part with

            this.dataset.test
        

is replaced by an access to the dataset. The call is formulated as follows:

            myFunction(this.dataset.test)
        

Here is the JavaScript for our example:

            function myFunction(nummer){

	alert(nummer);
	return true;
}