new ObjectField(app, field, obj)
- Description:
Field constructor
Parameters:
Name | Type | Description |
---|---|---|
app |
Simplicite.Ajax | Ajax services |
field |
Object | Field metadata |
obj |
Simplicite.Ajax.BusinessObject | Optional related business object |
Methods
(static) applyToReferences(obj, fn)
- Description:
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 |
(static) contains(code)
- Description:
Test if value or multi-enum contains a code
Parameters:
Name | Type | Description |
---|---|---|
code |
string | list code |
(static) dateToUI(v, df, r)
- Description:
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 |
(static) datetimeToUI(v, df, r)
- Description:
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 |
(static) displayValue(v, r)
- Description:
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 |
(static) formatFloat(v, lang, prec, num)
- Description:
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 |
(static) getCodeFromValue()
- Description:
Search the list code of a translated value
(static) getDate(v)
- Description:
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 |
(static) getDisplay()
- Description:
Field label in user language
(static) getEnumItem(c)
- Description:
Get the list item by code
Parameters:
Name | Type | Description |
---|---|---|
c |
string | code |
(static) hasChanged()
- Description:
Compare old and current value
(static) isDate(v)
- Description:
Test if YYYY-MM-DD exists ?
Parameters:
Name | Type | Description |
---|---|---|
v |
String | date |
(static) isDatetime(v)
- Description:
Test if YYYY-MM-DD HH:MI:SS exists ?
Parameters:
Name | Type | Description |
---|---|---|
v |
String | datetime |
(static) isDoc()
- Description:
Is a document?
(static) isEmpty()
- Description:
Test if value is empty
(static) isFile()
- Description:
Is a document or image?
(static) isFilterExpr(v)
- Description:
Is the filter an expression?
Parameters:
Name | Type | Description |
---|---|---|
v |
string | optional value to test (default use current object filter) |
(static) isFiltered(v)
- Description:
Is the field filtered?
Parameters:
Name | Type | Description |
---|---|---|
v |
string | number | boolean | Array | optional value to test (default use current object filter) |
(static) isForbidden()
- Description:
Test if the field is forbidden
(static) isForeignKey()
- Description:
Is a foreign key? (reference field belonging to object)
(static) isFunctId()
- Description:
Is a functional Id?
(static) isHidden(obj)
- Description:
Test if the field is hidden
Parameters:
Name | Type | Description |
---|---|---|
obj |
Simplicite.Ajax.BusinessObject | optional object to test if foreign-key is also visible |
(static) isImage()
- Description:
Is an image?
(static) isReferenced()
- Description:
Referenced/Belongs to other object?
(static) isRequired(obj)
- Description:
Test if the field is required
Parameters:
Name | Type | Description |
---|---|---|
obj |
Simplicite.Ajax.BusinessObject | optional object to test if foreign-key is also required |
(static) isTimestamp()
(static) isTrue()
- Description:
Test if value is true or equals to "1"
(static) isUpdatable()
- Description:
Test if the field is updatable
(static) isVisibleOnForm(obj)
- Description:
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 |
(static) isVisibleOnList(obj)
- Description:
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 |
(static) message(msg)
- Description:
UI message to display on field
Parameters:
Name | Type | Description |
---|---|---|
msg |
string | Optional message to set |
(static) oldvalue(v)
- Description:
Get or set the old service value
Parameters:
Name | Type | Description |
---|---|---|
v |
string | Optional value to set |
(static) percentage(v, t)
- Description:
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) |
(static) setDate(dt)
- Description:
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 |
(static) setVisible(vis)
- Description:
Change visibility
Parameters:
Name | Type | Description |
---|---|---|
vis |
boolean | number | true=both, false=hidden, or Simplicite.VIS_BOTH | VIS_HIDDEN | VIS_FORM | VIS_LIST |
(static) timeToUI(v, r)
- Description:
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 |
(static) toService(v)
- Description:
Convert displayed value to service format
Parameters:
Name | Type | Description |
---|---|---|
v |
string | Front-end value |
(static) toServiceDate(v, df)
- Description:
Convert UI date to service format YYYY-MM-DD
Parameters:
Name | Type | Description |
---|---|---|
v |
string | date from UI format |
df |
string | user date format |
(static) toServiceDatetime(v, df)
- Description:
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 |
(static) toServiceFloat(v, lang)
- Description:
Convert UI float to service format (as string to keep decimal precision) 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) |
(static) toServiceTime(v)
- Description:
Convert UI time to service format HH:MM:SS
Parameters:
Name | Type | Description |
---|---|---|
v |
string | time from UI rendering |
(static) typeLabel(type)
- Description:
Get label of field type
Parameters:
Name | Type | Description |
---|---|---|
type |
string | optional type |
(static) tz(v)
- Description:
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 |
(static) value(v, old)
- Description:
Get or set the service value
Parameters:
Name | Type | Description |
---|---|---|
v |
string | Optional service value to set |
old |
boolean | Copy value into old value? |