# JSPart

## Overview

The `JSPartWithConstants` class extends `JSPart` and adds support for prefixed constants through the `IPrefixedConstantsObject` interface. Should not be instantiated directly, as its constructor exists solely to meet interface requirements. The class provides a `getPrefix` method that returns the name of the `JSPart` class, enabling consistent handling of prefixed constants.

## Constants Summarized

| Type                                                     | Name              | Summary                                             |
| -------------------------------------------------------- | ----------------- | --------------------------------------------------- |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [BODY](#body)     | Constant use for specifying the type of form parts. |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [FOOTER](#footer) | Constant use for specifying the type of form parts. |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [HEADER](#header) | Constant use for specifying the type of form parts. |

## Properties Summarized

| Type                                                     | Name                      | Summary                                                         |
| -------------------------------------------------------- | ------------------------- | --------------------------------------------------------------- |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [background](#background) | The background color of the form part.                          |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [height](#height)         | The height of a selected part; specified in pixels.             |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [styleClass](#styleclass) | The Cascading Style Sheet (CSS) class name applied to the part. |

## Methods Summarized

| Type                                                      | Name                                | Summary                                                                                                        |
| --------------------------------------------------------- | ----------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| [String](/reference/servoycore/dev-api/js-lib/string.md)  | [getComment()](#getcomment)         | Returns the comment of this component.                                                                         |
| [Number](/reference/servoycore/dev-api/js-lib/number.md)  | [getPartType()](#getparttype)       | The type of this part.                                                                                         |
| [Number](/reference/servoycore/dev-api/js-lib/number.md)  | [getPartYOffset()](#getpartyoffset) | The Y offset of the part on the form, this will include all the super forms parts if this form extends a form. |
| [UUID](/reference/servoycore/dev-api/application/uuid.md) | [getUUID()](#getuuid)               | Returns the UUID of this component.                                                                            |

## Constants Detailed

### BODY

Constant use for specifying the type of form parts.

This is the default part that is repeated for each record (being\
displayed and/or printed).

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
var body = form.newPart(JSPart.BODY, 320);
```

### FOOTER

Constant use for specifying the type of form parts.

A footer is displayed at the bottom of each page when printed ad can\
contain summaries of the current selection of records. In List view, the\
footer is displayed at the bottom of the list of records.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
var footer = form.newPart(JSPart.FOOTER, 440);
```

### HEADER

Constant use for specifying the type of form parts.

A header is displayed at the top of each page when printed and can contain\
summaries of the current selection of records. In List view the header is\
displayed above the list of records. In tableview the default column headers will\
not be there if this is specified.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
var header = form.newPart(JSPart.HEADER, 80);
```

## Properties Detailed

### background

The background color of the form part.

NOTE: When no background color has been set, the default background\
color will be determined by the Look and Feel (LAF) that has been selected\
in Application Preferences.

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md)

**Sample**

```js
var body = form.newPart(JSPart.BODY, 320);
body.background = 'green';
```

### height

The height of a selected part; specified in pixels.

This height property is the lowerbound as its ending Y value (0 == top of the form).

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
var part = form.newPart(JSPart.HEADER, 100);
part.height = 200;
```

### styleClass

The Cascading Style Sheet (CSS) class name applied to the part.

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md)

**Sample**

```js
var body = form.newPart(JSPart.BODY, 320);
body.styleClass = 'myBody';
```

## Methods Detailed

### getComment()

Returns the comment of this component.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) the comment associated with this component.

**Sample**

```js
var comment = solutionModel.getForm("my_form").getButton("my_button").getComment();
application.output(comment);
```

### getPartType()

The type of this part.

**Returns:** [Number](/reference/servoycore/dev-api/js-lib/number.md) A number representing the type of the form part.

**Sample**

```js
var allParts = form.getParts()
for (var i=0; i<allParts.length; i++) {
	if (allParts[i].getPartType() == JSPart.BODY)
		application.output('body Y offset: ' + allParts[i].getPartYOffset());
}
```

### getPartYOffset()

The Y offset of the part on the form, this will include all the super forms parts if this form extends a form.

**Returns:** [Number](/reference/servoycore/dev-api/js-lib/number.md) A number holding the Y offset of the form part.

**Sample**

```js
var allParts = form.getParts()
for (var i=0; i<allParts.length; i++) {
	if (allParts[i].getPartType() == JSPart.BODY)
		application.output('body Y offset: ' + allParts[i].getPartYOffset());
}
```

### getUUID()

Returns the UUID of this component.

**Returns:** [UUID](/reference/servoycore/dev-api/application/uuid.md) the UUID of this component.

**Sample**

```js
var button_uuid = solutionModel.getForm("my_form").getButton("my_button").getUUID();
application.output(button_uuid.toString());
```

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.servoy.com/reference/servoycore/dev-api/solutionmodel/jspart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
