APIs

Show:

Base controller for the Edit Forms.

This class re-exports to the application as /controllers/edit-form. So, you can inherit from ./edit-form, even if file app/controllers/edit-form.js is not presented in the application.

Item Index

Methods

_destroyHasManyRelationships

(
  • model
)
Promise

Destroy (delete and save) all hasMany relationships in the model recursively. This method invokes by delete method.

Parameters:

  • model DS.Model

    Record with hasMany relationships.

Returns:

Promise:

A promise that will be resolved to array of destroyed records.

_getModelWithHasMany

(
  • model
)
Ember.NativeArray

Returns an array with the model and all its hasMany relationships, obtained recursively, for each model.

Parameters:

Returns:

Ember.NativeArray:

An array with the model and all its hasMany relationships.

_openModalDialog

(
  • modelObject
  • editFormRoute
  • isNewRecord
  • useSidePageMode
)
private
Open modal window fo edit record or create new record.

Parameters:

  • modelObject Object
    record or model controller, when record is created.
  • editFormRoute String
    name of edit record route for modal content.
  • isNewRecord Boolean
    flag indicates when modal record open fo create new record.
  • useSidePageMode Boolean
    Indicates when use side page mode.

_reloadModalData

(
  • currentContext
  • options
)
private
This method refreshes displayed data on lookup modal window. It reloads current lookup modal window in order to show loading image. Then proper request to load data is formed (it considers current page, filter, etc). After the data loading data are displayed on lookup modal window. This method is called during the first data loading and after each change of request parameters (current page, filter, etc) on lookup modal window controller (it is implemented by sending handler on this method to lookup modal window controller).

Parameters:

  • currentContext String
    Current execution context of this method.
  • options Object
    Parameters to load proper data and to tune modal lookup window outlook.
    • [relatedToType] String optional

      Type of records to load.

    • [projectionName] String optional

      Projection name to load data by.

    • [perPage] String optional

      Number of records to display on page.

    • [page] String optional

      Current page to display on lookup window.

    • [sorting] String optional

      Current sorting.

    • [filter] String optional

      Current filter.

    • [filterCondition] String optional

      Current filter condition.

    • [predicate] String optional

      Current limit predicate.

    • [title] String optional

      Title of modal lookup window.

    • [saveTo] String optional

      Options to save selected lookup value.

    • [currentLookupRow] String optional

      Current lookup value.

    • [customPropertiesData] String optional

      Custom properties of modal lookup window.

    • [componentName] String optional

      Component name of lookup component.

    • [notUseUserSettings] Boolean optional

      Not use user settings in the list component on lookup window.

_saveHasManyRelationships

(
  • model
)
Promise private

Save dirty hasMany relationships in the model recursively. This method invokes by save method.

Parameters:

  • model DS.Model

    Record with hasMany relationships.

Returns:

Promise:

A promise that will be resolved to array of saved records.

actions.addColumnToSorting

(
  • column
)

Add column into end list sorting.

Parameters:

  • column Object

    Column for sorting.

actions.addErrorMessage

(
  • msg
)
public
Add error message.

Parameters:

actions.close

(
  • skipTransition
  • rollBackModel
)

Default action for button 'Close'. You can override this action to add custom logic.

Parameters:

  • skipTransition Boolean

    If true, then transition during close form process will be skipped.

  • rollBackModel Boolean

    Flag: indicates whether to set flag to roll back model after route leave (if true) or not (if false).

Example:

// app/controllers/your-controller.js
                    ...
                    actions: {
                      ...
                      close() {
                        if (confirm('You sure?')) {
                          this.close();
                        }
                      }
                      ...
                    }
                    ...
                    

actions.delete

(
  • skipTransition
)

Default action for button 'Delete'. You can override this action to add custom logic.

Parameters:

  • skipTransition Boolean

    If true, then transition during close form process will be skipped after delete.

Example:

// app/controllers/your-controller.js
                    ...
                    actions: {
                      ...
                      delete() {
                        if (confirm('You sure?')) {
                          this.delete(false);
                        }
                      }
                      ...
                    }
                    ...
                    onDeleteActionFulfilled() {
                      alert('Successful delete!');
                      this.close();
                    }
                    ...
                    onDeleteActionRejected() {
                      alert('Failed delete!');
                    }
                    ...
                    

actions.dismissErrorMessages

() public
Dismiss error messages.

actions.error

(
  • error
)
Save the error.

Parameters:

actions.flexberryFileViewImageAction

(
  • selectedFileOptions
)
public
Handles {{#crossLink "FlexberryFileComponent"}}flexberry-file{{/crossLink}} viewImageAction: creates modal dialog with selected file preview.

Parameters:

  • selectedFileOptions Object
    Information about selected file.
    • [fileSrc] String optional

      File as base64string image data or as URL (to be setted as img tag's 'src' property).

    • [fileName] String optional

      File name to be setted as modal dialog caption.

actions.groupEditRowClick

(
  • record
  • [options]
)
{{#crossLink "FlexberryGroupeditComponent"}}{{/crossLink}} row click handler. It sets modelNoRollBack to true at current controller, redirects to detail's route, save necessary data to service.

Parameters:

  • record Ember.Object
    Record related to clicked table row.
  • [options] Object optional
    Record related to clicked table row.
    • saveBeforeRouteLeave Boolean

      Flag: indicates whether to save current model before going to the detail's route.

    • editOnSeparateRoute Boolean

      Flag: indicates whether to edit detail on separate route.

    • modelName String

      Clicked detail model name (used to create record if record is undefined).

    • detailArray Array

      Current detail array (used to add record to if record is undefined).

    • editFormRoute Boolean

      Path to detail's form.

actions.previewLookupValue

(
  • previewData
)
Handlers action from FlexberryLookup preview action.

Parameters:

  • previewData Object
    Lookup parameters: { recordId, transitionRoute, transitionOptions, showInSeparateRoute, projection, modelName, controller }.

actions.removeLookupValue

(
  • removeData
)
Handlers action from FlexberryLookup remove action.

Parameters:

  • removeData Object
    Lookup parameters: { relationName, modelToLookup }.

actions.routeWillTransition

() public
Handles corresponding route's willTransition action. It sends message about transition to modal dialog's controller.

actions.save

()

Default action for button 'Save'. You can override this action to add custom logic.

Example:

// app/controllers/your-controller.js
                    ...
                    actions: {
                      ...
                      save() {
                        if (confirm('You sure?')) {
                          this.save();
                        }
                      }
                      ...
                    }
                    ...
                    onSaveActionFulfilled() {
                      alert('Save successful!');
                    }
                    ...
                    onSaveActionRejected() {
                      alert('Save failed!');
                    }
                    ...
                    

actions.saveAndClose

(
  • skipTransition
)

Default action for button 'Save and close'. You can override this action to add custom logic.

Parameters:

  • skipTransition Boolean

    If true, then transition during close form process will be skipped after save.

Example:

// app/controllers/your-controller.js
                    ...
                    actions: {
                      ...
                      saveAndClose() {
                        if (confirm('You sure?')) {
                          this.save(true);
                        }
                      }
                      ...
                    }
                    ...
                    onSaveActionFulfilled() {
                      alert('Save successful!');
                    }
                    ...
                    onSaveActionRejected() {
                      alert('Save failed!');
                    }
                    ...
                    

actions.showLookupDialog

(
  • chooseData
)
Handles action from lookup choose action. It opens modal window where availible values are shown. In order to customize content of all lookup modal window there is such a way: 1. Create template with necessary content and set unique name for it (for example 'customlookupform.hbs'); 2. Override lookup setting lookupSettings.contentTemplate on controller level (for example 'customlookupform'); 3. If there has to be specific logic or properties on controller for template, current lookup controller can be overriden (it is 'lookup-dialog' for edit forms), new name can be set on lookup setting lookupSettings.controllerName and new controller can be injected as lookupController (if the controller was extended and not reopened).

Parameters:

  • chooseData Object
    Lookup parameters (projection name, relation name, etc).

actions.sortByColumn

(
  • column
)

Sorting list by column.

Parameters:

  • column Object

    Column for sorting.

actions.updateLookupValue

(
  • updateData
)
Update relation value at model.

Parameters:

  • updateData Object
    Lookup parameters to update data at model: { relationName, newRelationValue, modelToLookup }.

close

(
  • skipTransition
  • rollBackModel
)

Сlose edit form and transition to parent route.

Parameters:

  • skipTransition Boolean

    If true, then transition during close form process will be skipped.

  • rollBackModel Boolean

    Flag: indicates whether to set flag to roll back model after route leave (if true) or not (if false).

delete

(
  • skipTransition
)
Promise

Delete object, if successful transition to parent route.

Parameters:

  • skipTransition Boolean

    If true, then transition during close form process will be skipped after delete.

Returns:

getCellComponent

(
  • attr
  • bindingPath
  • modelClass
)
Object

Method to get type and attributes of component, which will be embeded in object-list-view cell.

Parameters:

  • attr Object

    Attribute of projection property related to current table cell.

  • bindingPath String

    Path to model property related to current table cell.

  • modelClass DS.Model

    Model class of data record related to current table row.

Returns:

Object:

Object containing name & properties of component, which will be used to render current table cell ({ componentName: 'my-component', componentProperties: { ... } }).

onDeleteActionFulfilled.

(
  • skipTransition
)

This method will be invoked when delete operation successfully completed. Override this method to add some custom logic on delete operation success.

Parameters:

  • skipTransition Boolean

    If true, then transition during close form process (default behavior) will be skipped.

Example:

onDeleteActionFulfilled() {
                      alert('Delete operation succeed!');
                      this.close(false);
                    }
                    

onDeleteActionRejected.

(
  • errorData
)

This method will be invoked when delete operation completed, but failed. Override this method to add some custom logic on delete operation fail.

Parameters:

  • errorData Object

    Data about delete operation fail.

Example:

onDeleteActionRejected() {
                      alert('Delete operation failed!');
                    }
                    

onDeleteActionStarted.

()

This method will be invoked before delete operation will be called. Override this method to add custom logic on delete operation start.

Example:

onDeleteActionStarted() {
                      alert('Delete operation started!');
                    }
                    

onDeleteActionStarted.

()

This method will be invoked before close method will be called. Override this method to add custom logic on close method start.

Example:

onCloseActionStarted() {
                      alert('Form will be closed right now!');
                    }
                    

onSaveActionAlways.

(
  • data
)

This method will be invoked always when save operation completed, regardless of save promise's state (was it fulfilled or rejected). Override this method to add some custom logic on save operation completion.

Parameters:

  • data Object

    Data about completed save operation.

Example:

onSaveActionAlways(data) {
                      alert('Save operation completed!');
                    }
                    

onSaveActionAlways.

(
  • data
)

This method will be invoked always when delete operation completed, regardless of save promise's state (was it fulfilled or rejected). Override this method to add some custom logic on delete operation completion.

Parameters:

  • data Object

    Data about completed save operation.

Example:

onDeleteActionAlways(data) {
                      alert('Delete operation completed!');
                    }
                    

onSaveActionFulfilled.

()

This method will be invoked when save operation successfully completed. Override this method to add some custom logic on save operation success.

Example:

onSaveActionFulfilled() {
                      alert('Save operation succeed!');
                    }
                    

onSaveActionRejected.

(
  • errorData
)

This method will be invoked when save operation completed, but failed. Override this method to add some custom logic on save operation fail.

Parameters:

  • errorData Object

    Data about save operation fail.

Example:

onSaveActionRejected() {
                      alert('Save operation failed!');
                    }
                    

onSaveActionStarted.

()

This method will be invoked before save operation will be called. Override this method to add some custom logic on save operation start.

Example:

onSaveActionStarted() {
                      alert('Save operation started!');
                    }
                    

openCreateModalDialog

(
  • modelController
  • editFormRoute
  • useSidePageMode
)
Open create record in modal window.

Parameters:

  • modelController Object
    parent model controller.
  • editFormRoute String
    name of edit record route for modal content.
  • useSidePageMode Boolean
    Indicates when use side page mode.

openEditModalDialog

(
  • record
  • editFormRoute
  • useSidePageMode
)
Open edit record in modal window.

Parameters:

  • record Object
    Record.
  • editFormRoute String
    name of edit record route for modal content.
  • useSidePageMode Boolean
    Indicates when use side page mode.

rejectError

(
  • errorData
  • message
)
public
Reject Error.

Parameters:

rollbackAll

()

Rollback current model.

rollbackHasManyRelationships

(
  • model
)
deprecated

Defined in addon/controllers/edit-form.js:873

Deprecated: Use `rollbackHasMany` from model.

Rollback dirty hasMany relationships in the model recursively. This method invokes by resetController in the edit-form route.

Parameters:

  • model DS.Model

    Record with hasMany relationships.

save

(
  • close
  • skipTransition
)
Promise

Save object.

Parameters:

  • close Boolean

    If true, then save and close.

  • skipTransition Boolean

    If true, then transition after save process will be skipped.

Returns:

saveModel

() Promise

The default save model logic implementation.

Returns:

transitionToParentRoute

(
  • skipTransition
)

Method transition to parent route (corresponding list form).

Parameters:

  • skipTransition Boolean

    If true, then transition will be skipped.

validate

() RSVP.Promise

Runs validation on validationObject and returns promise. Promise resolved if validation successful or rejected if validation failed. Promise always settled with ResultCollection object.

Returns:

Properties

_EmberCpValidationsResultCollectionClass

Unknown private

_modalControllerName

String private
Name of using modal controller

Default: 'editrecord-dialog'

_modalTemplateName

String private
Name of using modal template

Default: 'editrecord-dialog'

appState

AppStateService

Service for managing the state of the application.

contentTemplate

String
Name of template for content of modal window.

context

String
Modal context param. Selector or jquery object specifying the area to dim.

Default: '.ember-application > .ember-view'

controllerName

String
Name of controller that handles modal window. Controller with the same name has to be injected to property lookupController.

defaultDeveloperUserSettings

Object

Object with default developer user settings.

Default: undefined

destroyHasManyRelationshipsOnModelDestroy

Boolean

If true, all details will be deleted along with the main model.

Default: false

detachable

Boolean
Modal detachable param. If set to false will prevent the modal from being moved to inside the dimmer.

Default: false

developerUserSettings

Object

Object with developer user settings.

Default: undefined

flexberryDetailInteractionService

Service private

Service that lets interact between agregator's and detail's form.

flexberryFileModalController

Controller
Controller for modal dialog content.

Default: Injected flexberry-file-view-dialog controller.

flexberryFileModalTemplateName

String
Modal dialog content template's name.

Default: 'flexberry-file-view-dialog'

loaderTemplate

String
Name of template for content of loading modal window.

lookupController

Ember.InjectedProperty

Controller to show colsconfig modal window.

Default: Ember.inject.controller('colsconfig-dialog')

lookupController

Controller

Controller to show lookup modal window.

Default: LookupDialog

lookupEventsService

Service
Service that triggers lookup events.

lookupModalWindowPerPage

Number
Default number of records per page on lookup window list.

Default: 5

lookupSettings

Object

Object with settings for modal window.

Structure object:

  • controllerName - Controller name, default: 'lookup-dialog'.
  • template - Template name modal window, default: 'lookup-dialog'.
  • contentTemplate - Template name that rendering after loading data, default: 'lookup-dialog-content'.
  • loaderTemplate - Template name that will be visible while loading data, default: 'loading'.

modalDialogSettings

Object
Object with settings for modal window.

modelNoRollBack

Boolean

Flag to cancel rollback of model on controller resetting. Flag is set for interaction of agregator's and detail's routes.

Default: false

objectlistviewEvents

Service
Service that triggers objectlistview events.

parentRoute

String

Route name corresponding list form.

parentRouteRecordId

String

Parent route record ID.

queryParams

Array

Defines which query parameters the controller accepts. More info..

Default: ['readonly']

readonly

Boolean

Indicates whether the current form is opened only for reading.

Default: false

readonlyAttr

String | Undefined

Readonly HTML attribute following to the readonly query param. According to the W3C standard, returns 'readonly' if readonly is true and undefined otherwise.

TODO: Add unit test.

Default: undefined

returnToAgregatorRoute

Boolean

Flag to enable return to agregator's path if possible.

Default: false

routeName

String

Route name corresponding this edit form.

template

String
Name of template for modal window itself (not content of modal window).

validationModel

Any

Reference to object to be validated.

Default: model

validationObject

Any

Reference to object to be validated.

Default: model