Skip to content

Gravar JSON mais complexos com po-page-dynamic-edit #1893

Discussion options

You must be logged in to vote

Pessoal, descobri como resolver. Para quem tiver a mesma dúvida, a solução foi adicionar a ação beforeSave (PoPageDynamicEditActions) e atribui-la a uma função

  public readonly actions: PoPageDynamicEditActions = {
    save: '/admin/servico',
    saveNew: '/admin/servico/novo',
    beforeSave: this.beforeSave.bind(this)
  };

  beforeSave(data: any): PoPageDynamicEditBeforeSave {
    return {
      allowAction: true,
      resource: {
        campo2: {
          id: data.id
        }
      }
    };
  }

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by vodikus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: answered Issue with answer correct or accept
1 participant