Skip to content

$p.getField

Overview

This method retrieves the Field from the target column name. Use this when you want to show/hide the target column by label.

Syntax

JavaScript
$p.getField('Name of the field')

Usage Examples

Check the box to turn the column on or off.

(1) Set the following sample code to the Pleasanter script and set the output destination to "Edit", then enable the CheckA and ClassA column from the Editor tab.

(2) On the editing screen, switch check column A ON/OFF.

JavaScript
$p.events.on_editor_load = function () {
  $p.on('change', 'CheckA', function () {
    let classAField = $p.getField('ClassA')[0].id;
    document.getElementById($p.tableName() + '_CheckA').checked
      ? $('#' + classAField).hide()
      : $('#' + classAField).show()
  });
}