EditFormController Class
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
- _getModelWithHasMany
- _openModalDialog
- _reloadModalData
- _saveHasManyRelationships
- actions.addColumnToSorting
- actions.addErrorMessage
- actions.close
- actions.delete
- actions.dismissErrorMessages
- actions.error
- actions.flexberryFileViewImageAction
- actions.groupEditRowClick
- actions.previewLookupValue
- actions.removeLookupValue
- actions.routeWillTransition
- actions.save
- actions.saveAndClose
- actions.showLookupDialog
- actions.sortByColumn
- actions.updateLookupValue
- close
- delete
- getCellComponent
- onDeleteActionFulfilled.
- onDeleteActionRejected.
- onDeleteActionStarted.
- onDeleteActionStarted.
- onSaveActionAlways.
- onSaveActionAlways.
- onSaveActionFulfilled.
- onSaveActionRejected.
- onSaveActionStarted.
- openCreateModalDialog
- openEditModalDialog
- rejectError
- rollbackAll
- rollbackHasManyRelationships deprecated
- save
- saveModel
- transitionToParentRoute
- validate
Properties
- _EmberCpValidationsResultCollectionClass
- _modalControllerName
- _modalTemplateName
- appState
- contentTemplate
- context
- controllerName
- defaultDeveloperUserSettings
- destroyHasManyRelationshipsOnModelDestroy
- detachable
- developerUserSettings
- flexberryDetailInteractionService
- flexberryFileModalController
- flexberryFileModalTemplateName
- loaderTemplate
- lookupController
- lookupController
- lookupEventsService
- lookupModalWindowPerPage
- lookupSettings
- modalDialogSettings
- modelNoRollBack
- objectlistviewEvents
- parentRoute
- parentRouteRecordId
- queryParams
- readonly
- readonlyAttr
- returnToAgregatorRoute
- routeName
- template
- validationModel
- validationObject
Methods
_destroyHasManyRelationships
-
model
Destroy (delete and save) all hasMany relationships in the model recursively.
This method invokes by delete method.
Parameters:
-
modelDS.ModelRecord with hasMany relationships.
Returns:
A promise that will be resolved to array of destroyed records.
_getModelWithHasMany
-
model
Returns an array with the model and all its hasMany relationships, obtained recursively, for each model.
Parameters:
-
modelDS.ModelThe object model.
Returns:
An array with the model and all its hasMany relationships.
_openModalDialog
-
modelObject -
editFormRoute -
isNewRecord -
useSidePageMode
_reloadModalData
-
currentContext -
options
Parameters:
-
currentContextStringCurrent execution context of this method. -
optionsObjectParameters to load proper data and to tune modal lookup window outlook.-
[relatedToType]String optionalType of records to load.
-
[projectionName]String optionalProjection name to load data by.
-
[perPage]String optionalNumber of records to display on page.
-
[page]String optionalCurrent page to display on lookup window.
-
[sorting]String optionalCurrent sorting.
-
[filter]String optionalCurrent filter.
-
[filterCondition]String optionalCurrent filter condition.
-
[predicate]String optionalCurrent limit predicate.
-
[title]String optionalTitle of modal lookup window.
-
[saveTo]String optionalOptions to save selected lookup value.
-
[currentLookupRow]String optionalCurrent lookup value.
-
[customPropertiesData]String optionalCustom properties of modal lookup window.
-
[componentName]String optionalComponent name of lookup component.
-
[notUseUserSettings]Boolean optionalNot use user settings in the list component on lookup window.
-
_saveHasManyRelationships
-
model
Save dirty hasMany relationships in the model recursively.
This method invokes by save method.
Parameters:
-
modelDS.ModelRecord with hasMany relationships.
Returns:
A promise that will be resolved to array of saved records.
actions.addColumnToSorting
-
column
Add column into end list sorting.
Parameters:
-
columnObjectColumn for sorting.
actions.close
-
skipTransition -
rollBackModel
Default action for button 'Close'. You can override this action to add custom logic.
Parameters:
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:
-
skipTransitionBooleanIf
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
actions.flexberryFileViewImageAction
-
selectedFileOptions
actions.groupEditRowClick
-
record -
[options]
modelNoRollBack to true at current controller, redirects to detail's route, save necessary data to service.
Parameters:
-
recordEmber.ObjectRecord related to clicked table row. -
[options]Object optionalRecord related to clicked table row.-
saveBeforeRouteLeaveBooleanFlag: indicates whether to save current model before going to the detail's route.
-
editOnSeparateRouteBooleanFlag: indicates whether to edit detail on separate route.
-
modelNameStringClicked detail model name (used to create record if record is undefined).
-
detailArrayArrayCurrent detail array (used to add record to if record is undefined).
-
editFormRouteBooleanPath to detail's form.
-
actions.previewLookupValue
-
previewData
Parameters:
-
previewDataObjectLookup parameters: { recordId, transitionRoute, transitionOptions, showInSeparateRoute, projection, modelName, controller }.
actions.removeLookupValue
-
removeData
Parameters:
-
removeDataObjectLookup parameters: { relationName, modelToLookup }.
actions.routeWillTransition
()
public
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:
-
skipTransitionBooleanIf
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
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:
-
chooseDataObjectLookup parameters (projection name, relation name, etc).
actions.sortByColumn
-
column
Sorting list by column.
Parameters:
-
columnObjectColumn for sorting.
actions.updateLookupValue
-
updateData
Parameters:
-
updateDataObjectLookup parameters to update data at model: { relationName, newRelationValue, modelToLookup }.
close
-
skipTransition -
rollBackModel
Сlose edit form and transition to parent route.
delete
-
skipTransition
Delete object, if successful transition to parent route.
Parameters:
-
skipTransitionBooleanIf
true, then transition during close form process will be skipped after delete.
Returns:
getCellComponent
-
attr -
bindingPath -
modelClass
Method to get type and attributes of component, which will be embeded in object-list-view cell.
Parameters:
Returns:
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:
-
skipTransitionBooleanIf
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:
-
errorDataObjectData 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:
-
dataObjectData 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:
-
dataObjectData 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:
-
errorDataObjectData 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
openEditModalDialog
-
record -
editFormRoute -
useSidePageMode
rollbackAll
()
Rollback current model.
rollbackHasManyRelationships
-
model
Rollback dirty hasMany relationships in the model recursively.
This method invokes by resetController in the edit-form route.
Parameters:
-
modelDS.ModelRecord with hasMany relationships.
transitionToParentRoute
-
skipTransition
Method transition to parent route (corresponding list form).
Parameters:
-
skipTransitionBooleanIf
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
context
String
Default: '.ember-application > .ember-view'
controllerName
String
lookupController.
destroyHasManyRelationshipsOnModelDestroy
Boolean
If true, all details will be deleted along with the main model.
Default: false
detachable
Boolean
Default: false
flexberryDetailInteractionService
Service
private
Service that lets interact between agregator's and detail's form.
flexberryFileModalController
Controller
Default: Injected flexberry-file-view-dialog controller.
flexberryFileModalTemplateName
String
Default: 'flexberry-file-view-dialog'
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
lookupModalWindowPerPage
Number
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'.
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
queryParams
Array
Defines which query parameters the controller accepts. More info..
Default: ['readonly']
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
validationModel
Any
Reference to object to be validated.
Default: model
validationObject
Any
Reference to object to be validated.
Default: model
Flexberry Documentation