Project

General

Profile

ServoyExtensions

Servoy-specific extensions in mod_js_core

Introduction

In addition to adapted Prototype extensions, mod_js_core contains the following Servoy-specific extensions.

Foundset extensions

mod_js_core defines a global object $fs with contains several convenience methods for working with foundsets.

$fs.rec(foundset)
  • arguments:
    • foundset
  • returns: the current record from the foundset
$fs.loop(foundset, function)
  • arguments:
    • foundset
    • function: a function which takes a single argument. The function will be called once for each record in the foundset, with the current record passed as a argument.
  • return: nothing

Form extensions

$frm.rec(form)
  • arguments:
    • form: a form object. use 'this' when called from a form method
  • returns: the current record from the form's foundset
$frm.elementLoop(form, filter, function)
  • arguments:
    • form: a form object.
    • filter: optional argument is a regular expression, which will be used to filter the elements in the loop based on the element name.
    • function: a function which takes a single argument. The function will be called once for each element in the form, with the element passed as an argument. If the optional regular expression filter is passed, only those element's who's name matches the regular expression will be called.
  • returns: nothing