Class: ObjectField

Simplicite.Ajax.ObjectField

new ObjectField

Field constructor

Parameters:
Name Type Description
app Simplicite.Ajax Ajax services
field object Field metadata
obj Simplicite.Ajax.BusinessObject Optional related business object
Source:
  • objectfield.js, line 30

Methods

<static> applyToReferences

Apply a function to all referenced fields

Parameters:
Name Type Description
obj Simplicite.Ajax.BusinessObject Object
fn function function to apply to all referenced fields
Source:
  • objectfield.js, line 803

<static> contains

Test if value or multi-enum contains a code

Parameters:
Name Type Description
code string list code
Source:
  • objectfield.js, line 608

<static> datetimeToUI

Convert the datetime to UI format

Parameters:
Name Type Description
v string value YYYY-MM-DD HH:MI:SS or ISO-8601
df string datetime format DD/MM/YYYY HH:MI:SS or MM/DD/YYYY HH:MI:SS
r string optional rendering Y|M|D|H|I|S
Source:
  • objectfield.js, line 124

<static> dateToUI

Convert the date to UI format

Parameters:
Name Type Description
v string value YYYY-MM-DD
df string user date format
r string optional rendering Y|M|D|H|I|S
Source:
  • objectfield.js, line 75

<static> displayValue

Value in user language (enum label, boolean as yes/no, format date integer and float with the rendering)

Parameters:
Name Type Description
v string | number | object | array Backend value to display in user language (default is current value)
r boolean true to apply the rendering
Source:
  • objectfield.js, line 358

<static> formatFloat

Format a float "1234567.8" => FRA: "1 234 567,80000" - other: "1,234,567.80000"

Parameters:
Name Type Description
v string value "1234567.8"
lang string user language (FRA, ENU)
prec number precision (ex: 5)
num boolean simple number = no thousand separator
Source:
  • objectfield.js, line 145

<static> getCodeFromValue

Search the list code of a translated value

Source:
  • objectfield.js, line 768

<static> getDate

Convert the date value to javascript Date

Parameters:
Name Type Description
v string service date YYYY-MM-DD or datetime YYYY-MM-DD HH:MI:SS
Source:
  • objectfield.js, line 294

<static> getDisplay

Field label in user language

Source:
  • objectfield.js, line 794

<static> getEnumItem

Get the list item by code

Parameters:
Name Type Description
c string code
Source:
  • objectfield.js, line 781

<static> hasChanged

Compare old and current value

Source:
  • objectfield.js, line 506

<static> isDate

Test if YYYY-MM-DD exists ?

Parameters:
Name Type Description
v String date
Source:
  • objectfield.js, line 342

<static> isDatetime

Test if YYYY-MM-DD HH:MI:SS exists ?

Parameters:
Name Type Description
v String datetime
Source:
  • objectfield.js, line 349

<static> isDoc

Is a document?

Source:
  • objectfield.js, line 711

<static> isEmpty

Test if value is empty

Source:
  • objectfield.js, line 589

<static> isFile

Is a document or image?

Source:
  • objectfield.js, line 702

<static> isFiltered

Is the field filtered?

Parameters:
Name Type Description
v string | number | boolean | array optional value to test (default use current object filter)
Source:
  • objectfield.js, line 820

<static> isFilterExpr

Is the filter an expression?

Parameters:
Name Type Description
v string optional value to test (default use current object filter)
Source:
  • objectfield.js, line 838

<static> isForbidden

Test if the field is forbidden

Source:
  • objectfield.js, line 662

<static> isForeignKey

Is a foreign key? (reference field belonging to object)

Source:
  • objectfield.js, line 750

<static> isFunctId

Is a functional Id?

Source:
  • objectfield.js, line 741

<static> isHidden

Test if the field is hidden

Parameters:
Name Type Description
obj Simplicite.Ajax.BusinessObject optional object to test if foreign-key is also visible
Source:
  • objectfield.js, line 648

<static> isImage

Is an image?

Source:
  • objectfield.js, line 720

<static> isReferenced

Referenced/Belongs to other object?

Source:
  • objectfield.js, line 759

<static> isRequired

Test if the field is required

Parameters:
Name Type Description
obj Simplicite.Ajax.BusinessObject optional object to test if foreign-key is also required
Source:
  • objectfield.js, line 730

<static> isTimestamp

Source:
  • objectfield.js, line 692

<static> isTrue

Test if value is true or equals to "1"

Source:
  • objectfield.js, line 598

<static> isUpdatable

Test if the field is updatable

Source:
  • objectfield.js, line 683

<static> isVisibleOnForm

Test if the field is visible on form

Parameters:
Name Type Description
obj Simplicite.Ajax.BusinessObject optional object to test if foreign-key is also visible
Source:
  • objectfield.js, line 633

<static> isVisibleOnList

Test if the field is visible on list

Parameters:
Name Type Description
obj Simplicite.Ajax.BusinessObject optional object to test if foreign-key is also visible
Source:
  • objectfield.js, line 618

<static> message

UI message to display on field

Parameters:
Name Type Description
msg string Optional message to set
Source:
  • objectfield.js, line 579

<static> oldvalue

Get or set the old service value

Parameters:
Name Type Description
v string Optional value to set
Source:
  • objectfield.js, line 474

<static> percentage

Get value as percentage value

Parameters:
Name Type Description
v string value
t number optional type (Simplicite.TYPE_INT, Simplicite.TYPE_FLOAT or Simplicite.TYPE_BIGDECIMAL)
Source:
  • objectfield.js, line 489

<static> setDate

Convert javascript Date to value YYYY-MM-DD or YYYY-MM-DD HH:MI:SS when field is a datetime

Parameters:
Name Type Description
dt Date Date
Source:
  • objectfield.js, line 321

<static> setVisible

Change visibility

Parameters:
Name Type Description
vis boolean | number true=both, false=hidden, or Simplicite.VIS_BOTH | VIS_HIDDEN | VIS_FORM | VIS_LIST
Source:
  • objectfield.js, line 672

<static> timeToUI

Convert the time to UI format

Parameters:
Name Type Description
v string value HH:MI:SS
r string optional rendering Y|M|D|H|I|S
Source:
  • objectfield.js, line 101

<static> toService

Convert displayed value to service format

Parameters:
Name Type Description
v string Front-end value
Source:
  • objectfield.js, line 437

<static> toServiceDate

Convert UI date to service format YYYY-MM-DD

Parameters:
Name Type Description
v string date from UI format
df string user date format
Source:
  • objectfield.js, line 198

<static> toServiceDatetime

Convert UI datetime to service format YYYY-MM-DD HH:MI:SS (or ISO-8601 with user time zone)

Parameters:
Name Type Description
v string datetime from UI format
df string user date format
Source:
  • objectfield.js, line 259

<static> toServiceFloat

Convert UI float to service format YYYY-MM-DD FRA: "1 234 567,80808080808" - other: "1,234,567.80808080808" => "1234567.80808080808"

Parameters:
Name Type Description
v string UI value
lang string user language (FRA, ENU)
Source:
  • objectfield.js, line 276

<static> toServiceTime

Convert UI time to service format HH:MM:SS

Parameters:
Name Type Description
v string time from UI rendering
Source:
  • objectfield.js, line 230

<static> tz

Convert service date to ISO-8601 when user has a specific timezone (exclude timestamp fields)

Parameters:
Name Type Description
v string datetime YYYY-MM-DD HH:MM:SS
Source:
  • objectfield.js, line 248

<static> value

Get or set the service value

Parameters:
Name Type Description
v string Optional service value to set
old boolean Copy value into old value?
Source:
  • objectfield.js, line 459