dfaruque / Serenity.Extra

Name of the repo says that this is an EXTRA of http://serenity.is platform
60 stars 34 forks source link

Passing value with the initDetailEditor and Formatting issue with detail editor inside the Master record #1

Closed wirble closed 6 years ago

wirble commented 6 years ago

Hi thanks for sharing this.

I was trying it out and liked the default layout of the grid and a few others.

I was trying to get data to push from the Master table to Detail or vice versa. I added below to the master dialog.ts file: _Ext.q.initDetailEditor(this, this.form.someDetailField) ,then changed only the master Dialog to _Ext.DialogBase and within the detail table editor.ts file changed to _Ext.GridEditorBase.

So within the detail editor.ts file, I was able to do: this.parentDialog.... but not this.parentEditor.parentDialog

Question:

  1. How do I actually set an element on the parent table once a field in the detail table is set? or vice versa?

  2. I noticed that once I changed the dialog.ts file in the detail table. Within the the master table where the editor is shown, it LOSS the display name and becomes expanded from the rest.

Serenity.EntityDialog | _Ext.DialogBase

dfaruque commented 6 years ago

you should also derive your editor dialog from _Ext.EditorDialogBase. then you should be able to use it from your editorDialog like (this.parentEditor.parentDialog as yourParentDialog).form.someField.value = '123'

if you like to show the label/displayName of detail editor; you may use q.initDetailEditor(this, this.form.someDetailField, { showCaption: true});

wirble commented 6 years ago

Thanks again, it works great.

A general question to make sure I got it right and maybe someone else in the future.

To get the parentDialog functions: Change superclass of:

  1. parent dialog.ts
  2. detail editor.ts
  3. detail editordialog.ts Then in editordialog.ts, you can do: (this.parentEditor.parentDialog as yourParentDialog).form.someField.value = '123'

Are the following statements accurate, I am just trying to get a sense of what does what? You don't have to change superclass of detail dialog.ts for the parentDialog functions... You can change grid.ts superclass to get other functionalities such as the 'view details' button or inline editing in the parent view etc...

It seems like they all should be changed to get a consistent look and feel.

Again, thanks for sharing; it looks pretty good.

dfaruque commented 6 years ago

yes. it is recommended to replace all super classes according to the following mapping.

Serenity Default _Ext
Serenity.EntityGrid _Ext.GridBase
Serenity.EntityDialog _Ext.DialogBase
Common.GridEditorBase _Ext.GridEditorBase
Common.EditorDialogBase _Ext.EditorDialogBase

so that all grids and dialogs maintain a consistent look and behavior.