Class Index | File Index

Classes


Class Simplicite.Ajax.BusinessObject


Defined in: businessobject.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Simplicite.Ajax.BusinessObject(app, objName, objInstName, autoRefreshMetaData)
Simplicité® business object.
Field Summary
Field Attributes Field Name and Description
 
Current search result count.
 
Current cross table data.
 
Current search filters.
 
Current item.
 
Current search result array of items.
 
Current search result max page index (for paginated searches).
 
Current meta data.
 
Current search result page index (for paginated searches).
Method Summary
Method Attributes Method Name and Description
 
action(callback, act, params)
Calls an object action and loads action result.
 
completion(callback, field, req, params)
Calls an object completion for specified field and loads action result.
 
create(callback, item, params)
Creates and loads an item.
 
crosstab(callback, ctb, filters, params)
Loads cross table data for search filters.
 
crosstabChartImage(callback, ctb, filters, params)
Gets cross table data chart JPG image for search filters.
 
del(callback, item, params)
Deletes item.
 
get(callback, rowId, params)
Selects and loads an item for designated row ID (if row ID is Simplicite.Ajax.DEFAULT_ROW_ID, a defaut item for creation is returned with all default values applied).
 
getField(name)
Gets field from fields array in meta data (returns undefined if field is not found).
 
Gets fields array from meta data (is undefined as long as meta data are not loaded using getMetaData).
 
getFilters(callback, params)
Loads current filters.
 
getFiltersForSearch(callback, params)
Loads current filters for search (equivalent to a getFilters done with the search init context Simplicite.Ajax.CONTEXT_SEARCH).
 
getForCopy(callback, rowId, params)
Loads item for designated row ID for copy (equivalent to a get done with the copy init context Simplicite.Ajax.CONTEXT_COPY).
 
getForCreate(callback, params)
Loads default item for creation (equivalent to a get done on default row ID with the create init context Simplicite.Ajax.CONTEXT_CREATE).
 
getForDelete(callback, rowId, params)
Loads item for designated row ID for delete (equivalent to a get done with the delete init context Simplicite.Ajax.CONTEXT_DELETE).
 
getForUpdate(callback, rowId, params)
Loads item for designated row ID for update (equivalent to a get done with the update init context Simplicite.Ajax.CONTEXT_UPDATE).
 
Gets help from meta data (is undefined as long as meta data are not loaded using getMetaData).
 
Gets instance name from meta data.
 
Gets label from meta data (is undefined as long as meta data are not loaded using getMetaData).
 
Gets links array from meta data (is undefined as long as meta data are not loaded using getMetaData).
 
getListValue(list, code)
Gets value from list for specified code (returns undefined if code is not in list).
 
getMetaData(callback, params)
Loads meta data for specified context.
 
Gets name from meta data.
 
getParameter(callback, name, params)
Loads an object parameter.
 
Gets current item row Id value (returns undefined if not current item is loaded).
 
Gets row Id field from meta data (returns undefined if row Id field name is undefined).
 
Gets row Id field name from meta data (is undefined as long as meta data are not loaded using getMetaData).
 
getValueForCode(field, code)
Gets list of values field value from code (returns code if not found or not a list of value field)
 
Checks whether a field is the row ID field.
 
Checks whether a field is a timestamp field.
 
populate(callback, item, params)
Populate item (e.g.
 
print(callback, prt, params)
Calls an object publication and loads publication result.
 
removeParameter(callback, name, params)
Remove an object parameter.
 
save(callback, item, params)
Saves (create or update) and loads an item.
 
search(callback, filters, params)
Search and loads search result items.
 
searchForList(callback, filters, params)
Search and loads search result items for list (equivalent to a search done with the list init context Simplicite.Ajax.CONTEXT_LIST).
 
searchForPanelList(callback, filters, params)
Search and loads search result items for panel list (equivalent to a search done with the list init context Simplicite.Ajax.CONTEXT_PANELLIST).
 
Same as get function
 
Same as getForCopy function
 
Same as getForCreate function
 
Same as getForDelete function
 
Same as getForUpdate function
 
setParameter(callback, name, value, params)
Sets (or remove) an object parameter and loads it back.
 
update(callback, item, params)
Updates and loads an item.
Class Detail
Simplicite.Ajax.BusinessObject(app, objName, objInstName, autoRefreshMetaData)
Simplicité® business object.
Getting a new business object should use the Simplicite.Ajax.getBusinessObject() function instead of this constructor
Parameters:
app
Application Simplicite.Ajax instance
objName
Object name
objInstName
Object instance name, optional (defauts to ajax_<object name>)
autoRefreshMetaData
Automatic refresh of metadata at each call (defaults to false)
Field Detail
count
Current search result count.

crosstabdata
Current cross table data.

filters
Current search filters. Use filters["<field name>"] or filters.<field name> to access to the filter value

item
Current item. Use item["<field name>"] or item.<field name> to access to the field value

list
Current search result array of items.

maxpage
Current search result max page index (for paginated searches).

metadata
Current meta data.

page
Current search result page index (for paginated searches).
Method Detail
action(callback, act, params)
Calls an object action and loads action result.
Parameters:
callback
Callback function called when loading is completed (action result is passed to this function)
act
Action name
params
Optional parameters :
  • async Asynchronous call (use default if absent) ?
  • error Custom error handler (use default error handler if absent) ?

completion(callback, field, req, params)
Calls an object completion for specified field and loads action result.
Parameters:
callback
Callback function called when loading is completed (completion result is passed to this function)
field
Field name
req
Completion request
params
Optional parameters :
  • async Asynchronous call (use default if absent) ?
  • error Custom error handler (use default error handler if absent) ?

create(callback, item, params)
Creates and loads an item.
Parameters:
callback
Callback function called when loading is completed
item
Item to be created (row ID field of the item must be set to Simplicite.Ajax.DEFAULT_ROW_ID), optional (if absent current item is used)
params
Optional parameters :
  • async Asynchronous call (use default if absent) ?
  • error Custom error handler (use default error handler if absent) ?

crosstab(callback, ctb, filters, params)
Loads cross table data for search filters.
Parameters:
callback
Callback function called when loading is completed
ctb
Cross table name
filters
Filters to be applied, optional (if absent, current filters are used)
params
Optional parameters :
  • async Asynchronous call (use default if absent) ?
  • error Custom error handler (use default error handler if absent) ?

crosstabChartImage(callback, ctb, filters, params)
Gets cross table data chart JPG image for search filters.
Parameters:
callback
Callback function called when loading is completed
ctb
Cross table name
filters
Filters to be applied, optional (if absent, current filters are used)
params
Optional parameters :
  • async Asynchronous call (use default if absent) ?
  • error Custom error handler (use default error handler if absent) ?

    del(callback, item, params)
    Deletes item. Current item is set to undefined.
    Parameters:
    callback
    Callback function called when loading is completed
    item
    Item to be deleted (in fact only row ID field is used), optional (if absent current item is used)
    params
    Optional parameters :
    • async Asynchronous call (use default if absent) ?
    • error Custom error handler (use default error handler if absent) ?

    get(callback, rowId, params)
    Selects and loads an item for designated row ID (if row ID is Simplicite.Ajax.DEFAULT_ROW_ID, a defaut item for creation is returned with all default values applied).
    Parameters:
    callback
    Callback function called when loading is completed
    rowId
    Row ID, mandatory
    params
    Optional parameters object may include:
    • context Init context (one of Simplicite.Ajax.CONTEXT_CREATE/UPDATE/DELETE/COPY constants)
    • inlineDocs Inline documents (false if absent or undefined, can be a boolean or an array of document fields to inline) ?
    • inlineThumbs Inline image documents thumbnails (false if absent or undefined, can be a boolean or an array of image document fields to inline) ?
    • inlineObjs Inline objects fields items (false if absent or undefined, can be a boolean or an array of object fields to inline) ?
    • fields Array of field names to retreive (if absent or undefined, all fields are retreived)
    • async Asynchronous call (use default if absent or undefined) ?
    • error Custom error handler (use default error handler if absent) ?

      getField(name)
      Gets field from fields array in meta data (returns undefined if field is not found).
      Parameters:
      name
      Field name

      getFields()
      Gets fields array from meta data (is undefined as long as meta data are not loaded using getMetaData).

      getFilters(callback, params)
      Loads current filters.
      Parameters:
      callback
      Callback function called when loading is completed
      params
      Optional parameters :
      • context Init context (normally Simplicite.Ajax.CONTEXT_SEARCH constant), optional
      • reset Reset filters, optional
      • async Asynchronous call (use default if absent) ?
      • error Custom error handler (use default error handler if absent) ?

      getFiltersForSearch(callback, params)
      Loads current filters for search (equivalent to a getFilters done with the search init context Simplicite.Ajax.CONTEXT_SEARCH).
      Parameters:
      callback
      Callback function called when loading is completed
      params
      Optional parameters

      getForCopy(callback, rowId, params)
      Loads item for designated row ID for copy (equivalent to a get done with the copy init context Simplicite.Ajax.CONTEXT_COPY).
      Parameters:
      callback
      Callback function called when loading and context initialization is completed
      rowId
      Row ID, mandatory
      params
      Optional parameters (same as for get function)

      getForCreate(callback, params)
      Loads default item for creation (equivalent to a get done on default row ID with the create init context Simplicite.Ajax.CONTEXT_CREATE).
      Parameters:
      callback
      Callback function called when loading is completed
      params
      Optional parameters (same as for get function)

      getForDelete(callback, rowId, params)
      Loads item for designated row ID for delete (equivalent to a get done with the delete init context Simplicite.Ajax.CONTEXT_DELETE).
      Parameters:
      callback
      Callback function called when loading and context initialization is completed
      rowId
      Row ID, mandatory
      params
      Optional parameters (same as for get function)

      getForUpdate(callback, rowId, params)
      Loads item for designated row ID for update (equivalent to a get done with the update init context Simplicite.Ajax.CONTEXT_UPDATE).
      Parameters:
      callback
      Callback function called when loading and context initialization is completed
      rowId
      Row ID, mandatory
      params
      Optional parameters (same as for get function)

      getHelp()
      Gets help from meta data (is undefined as long as meta data are not loaded using getMetaData).

      getInstance()
      Gets instance name from meta data.

      getLabel()
      Gets label from meta data (is undefined as long as meta data are not loaded using getMetaData).

      getLinks()
      Gets links array from meta data (is undefined as long as meta data are not loaded using getMetaData).

      getListValue(list, code)
      Gets value from list for specified code (returns undefined if code is not in list).
      Parameters:
      list
      List metadata (typically from a field metadata)
      code
      Code

      getMetaData(callback, params)
      Loads meta data for specified context.
      Sample usage:
      obj.getMetaData(function() {
      	alert("Meta data loaded for update of object " + this.getName());
      }, { context: app.CONTEXT_UPDATE });
      
      Parameters:
      callback
      Callback function called when loading is completed
      params
      Optional parameters :
      • context Context (one of Simplicite.Ajax.CONTEXT_* constants)
      • contextParam Context parameter
      • async Asynchronous call (use default if absent) ?
      • error Custom error handler (use default error handler if absent) ?

      getName()
      Gets name from meta data.

      getParameter(callback, name, params)
      Loads an object parameter.
      Parameters:
      callback
      Callback function called when loading is completed (parameter is passed to this function)
      name
      Parameter name
      params
      Optional parameters :
      • async Asynchronous call (use default if absent) ?
      • error Custom error handler (use default error handler if absent) ?

      getRowId()
      Gets current item row Id value (returns undefined if not current item is loaded).

      getRowIdField()
      Gets row Id field from meta data (returns undefined if row Id field name is undefined).

      getRowIdFieldName()
      Gets row Id field name from meta data (is undefined as long as meta data are not loaded using getMetaData).

      getValueForCode(field, code)
      Gets list of values field value from code (returns code if not found or not a list of value field)
      Parameters:
      field
      Field
      code
      Field code

      isRowIdField(f)
      Checks whether a field is the row ID field.
      Parameters:
      f
      Field meta data

      isTimestampField(f)
      Checks whether a field is a timestamp field.
      Parameters:
      f
      Field meta data

      populate(callback, item, params)
      Populate item (e.g. after getForCreate and after having set foreign keys)
      Parameters:
      callback
      Callback function called when loading is completed
      item
      Item to be populated, optional (if absent current item is used)
      params
      Optional parameters object may include:
      • inlineDocs Inline documents (false if absent or undefined, can be a boolean or an array of document fields to inline) ?
      • inlineThumbs Inline image documents thumbnails (false if absent or undefined, can be a boolean or an array of image document fields to inline) ?
      • inlineObjs Inline object fields items (false if absent or undefined, can be a boolean or an array of object fields to inline) ?
      • async Asynchronous call (use default if absent or undefined) ?
      • error Custom error handler (use default error handler if absent) ?

      print(callback, prt, params)
      Calls an object publication and loads publication result.
      Parameters:
      callback
      Callback function called when loading is completed (publication result is passed to this function)
      prt
      Print template name
      params
      Optional parameters :
      • all Apply template to all items matching current filters (false by default, which means apply template only to current item) ?
      • mailing Apply template individually to all items matching current filter (false by default) ?
      • async Asynchronous call (use default if absent) ?
      • error Custom error handler (use default error handler if absent) ?

      removeParameter(callback, name, params)
      Remove an object parameter.
      Parameters:
      callback
      Callback function called when completed
      name
      Parameter name
      params
      Optional parameters :
      • async Asynchronous call (use default if absent) ?
      • error Custom error handler (use default error handler if absent) ?

      save(callback, item, params)
      Saves (create or update) and loads an item.
      Parameters:
      callback
      Callback function called when loading is completed
      item
      Item to be saved, optional (if absent current item is used)
      params
      Optional parameters

      search(callback, filters, params)
      Search and loads search result items.
      Parameters:
      callback
      Callback function called when loading is completed
      filters
      Filters to be applied, optional (if absent, current filters are used)
      params
      Optional parameters :
      • context Init context (normally one of Simplicite.Ajax.CONTEXT_LIST/PANELLIST/REFSELECT/DATAMAPSELECT/EXPORT/CROSSTAB/GRAPH/PRINTTMPL constant), optional
      • page Page index to retreive (must be between 1 and maxpage), optional (if absent or set to 0 no pagination will be done, for pagination a first call must be done with pageIndex set to 1)
      • inlineDocs Inline documents (false if absent or undefined, can be a boolean or an array of document fields to inline) ?
      • inlineThumbs Inline image documents thumbnails (false if absent or undefined) ?
      • inlineObjs Inline objects fields items (false if absent or undefined, can be a boolean or an array of object fields to inline) ?
      • async Asynchronous call (use default if absent) ?
      • error Custom error handler (use default error handler if absent) ?

      searchForList(callback, filters, params)
      Search and loads search result items for list (equivalent to a search done with the list init context Simplicite.Ajax.CONTEXT_LIST).
      Parameters:
      callback
      Callback function called when loading is completed
      filters
      Filters to be applied, optional (if absent, current filters are used)
      params
      Optional parameters

      searchForPanelList(callback, filters, params)
      Search and loads search result items for panel list (equivalent to a search done with the list init context Simplicite.Ajax.CONTEXT_PANELLIST).
      Parameters:
      callback
      Callback function called when loading is completed
      filters
      Filters to be applied, optional (if absent, current filters are used)
      params
      Optional parameters

      select()
      Same as get function

      selectForCopy()
      Same as getForCopy function

      selectForCreate()
      Same as getForCreate function

      selectForDelete()
      Same as getForDelete function

      selectForUpdate()
      Same as getForUpdate function

      setParameter(callback, name, value, params)
      Sets (or remove) an object parameter and loads it back.
      Parameters:
      callback
      Callback function called when loading is completed (parameter is passed to this function)
      name
      Parameter name
      value
      Parameter value (if undefined parameter is unset)
      params
      Optional parameters :
      • async Asynchronous call (use default if absent) ?
      • error Custom error handler (use default error handler if absent) ?

      update(callback, item, params)
      Updates and loads an item.
      Parameters:
      callback
      Callback function called when loading is completed
      item
      Item to be updated, optional (if absent current item is used)
      params
      Optional parameters :
      • async Asynchronous call (use default if absent) ?
      • error Custom error handler (use default error handler if absent) ?

      Documentation generated by JsDoc Toolkit 2.3.2 on Thu Jun 22 2023 13:22:31 GMT-0000 (UTC)